I have a 3-command .bat file that runs fine as 3 separate commands (entered 1 at a time into command line) but does not work when I put them as 3 lines in a bat file.
Here's the file:
mogrify -format pgm ephemeral:*.png
pause
CALL forfiles /M *.pgm /C "cmd /c for %s in (@fname) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i %s.pgm -o %s.ppm
pause
mogrify -format png ephemeral:*.ppm
The first command runs fine, but the command line gives me this error for the second command:
s.pgm was unexpected at this time
The reason I have that for loop with fname and %s is because the debayer.exe program doesn't understand @fname.pgm as a filename, but it does realize that's means bring in a string, so it does that, and then forfiles recognizes @fname and replaces it with the current file name.
Any ideas on how to solve this problem?
I have tried:
Putting %%
instead of %
Putting a ^
infront of each %
Adding the CALL
that is in the above code
Adding semicolons to the end of each line.
First remove the CALL
it's useless here and it will start the parse a second time so it will remove percent signs.
And double the percent signs, as they will be halfed one time.
forfiles /M *.pgm /C "cmd /c for %%s in (@fname) do DebayerGPU.exe -demosaic DFPD_R -CPU -pattern GRBG -i %%s.pgm -o %%s.ppm