I am making a batch file (Let's call it Create.bat) that will create a batch file (Let's call it Created.bat) that will get multiple commands inserted in it.
One of the commands is as follows:
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %TEST%"') DO IF %%%x == %TEST% goto ProgramON
But when I open Created.bat to edit after running Create.bat, I see the following code inserted:
FOR /F %%x == %TEST% goto ProgramON
Why does it cut out a portion of the code, and how can I fix it?
Some characters have to be escaped. Most of them (
&<>|
) with a caret (^
). Percent signs are escaped with another percent sign: