I have a case where I need to run an Windows command prompt application and it has to be done as a batch-file ( .bat ) and I need to get the Switch variables %1 and %2 in to that batch files as the file paths for it to process.
I have done it on Mac with shell scripts but can't get it to work in the batch file on Windows.
Thanks
Jan
Running WIN batch files containing %1 and %2 variables
Re: Running WIN batch files containing %1 and %2 variables
A lot ot trial and error finally got it right.
This is different depending on what app you run in Execute Command. In the case of PDF Toolkit it will not accept the spaces in the path if you just write the command in the Arguments property. Other CLI apps accept this but not PDFtk.
And in some cases the file variables need quotes and in some no quotes.
So in the arguments I have this "%1" "%2"
And in Command or path I have the path to the Batch file that will shuffle the 2 pages in a PDF so that the last page is first page.
Batch file looks like this
Hope this will help someone.
Jan
This is different depending on what app you run in Execute Command. In the case of PDF Toolkit it will not accept the spaces in the path if you just write the command in the Arguments property. Other CLI apps accept this but not PDFtk.
And in some cases the file variables need quotes and in some no quotes.
So in the arguments I have this "%1" "%2"
And in Command or path I have the path to the Batch file that will shuffle the 2 pages in a PDF so that the last page is first page.
Code: Select all
C:\switch_scripts\shuffle.bat
Code: Select all
set inputfile=%1
set outfile=%2
pdftk.exe A=%inputfile% cat A2 A1 output %outfile%
Hope this will help someone.
Jan