I am fairly new to PowerShell and I'm struggling to see what's wrong with the following command:
Get-ChildItem -Filter "*Q1 2016.pdf" | For.\pdftk A={$_.name} B={$_.name -replace 'Q1 2016.pdf','Q1 2016-quad.pdf'} cat A1-3 B1 A5-end output {$_.name -replace 'Q1 2016.pdf','Q1 2016-final.pdf'}
I get the following error:
pdftk.exe : The command parameter was already specified.
At line:1 char:40
+ ... 2016.pdf" | .\pdftk A={$_.name} B={$_.name -replace 'Q1 2016.pdf','Q1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], ParameterBindingException
+ FullyQualifiedErrorId : ParameterSpecifiedAlready
However, when I run a single command call, it works fine:
.\pdftk A='myfile-Q1 2016.pdf' B='myfile-Q1 2016-quad.pdf' cat A1-3 B1 A5-end output 'myfile-final.pdf'
Any thoughts of what am I doing wrong?