I have a batch file which should get a directory and process all jpeg files in it using an application that i have.
The batch file is:
for %%I in (%1\*.jpg) do (
bin\process.exe %%I "%~dpI\output\%~nxI"
)
but when I am running this batch file, I am getting this error:
The following usage of the path operator in batch-parameter substitution is invalid: %~dpI\output\%~nxI"
I read the format specifier and it says:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
based on it, the syntax should be correct?
What is the problem?
Inside a batch file, you need two % symbols when you're using the for loop variables. Variables like %I would only be for the command line. You should be saying
for %%I in (%1\*.jpg) do (
bin\process.exe %%I "%%~dpI\output\%%~nxI"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With