I need to execute often the following command which compresses all the PNG files in a folder:
for %i in (*.png) do pngout.exe "%i" /kp
So I have added this command in a file png.cmd and added the folder to the system PATH.
However when I execute the command (png.cmd) from a point in my file system, I get the following error:
C:\Users\Desktop>png
i" /kp was unexpected at this time.
Is there a way to fix this problem, also I’m thinking where the shell is going to execute the png.cmd command ? In the path where I’ve created the png.cmd file ? I’d need to execute it in the current PATH where I’m with the shell.
Any idea?
Thanks a alot
Your syntax error is caused by using only 1
%in yourforloop variable, when you use a batch file you need to use 2 to escape the first one.With regards to your path question, fix this first, then see if it’s still an issue.