In a standard windows batch file (.cmd) I want to do:
FOR /F "skip=0" %%G IN (filename.txt) DO ( ECHO %%G )
but I get " was unexpected at this time.
"skip=1" works fine (In my actual code 0 is a variable).
According to ss64.com the default is skip=0, but it seems not to work when explicitly set.
Am I doing it wrong? Or is there a workaround I can use?
Edit:
I have tried this on both Windows server 2003 and Windows 7.
The content of filename.txt could be:
something
stuff
unicorns
It really doesn’t like the
0, causing the parser to expect more after it (You can also trip it when trying to use09which it tries parsing as octal, which fails).I guess you need to create an environment variable holding the entire
skip=npart or nothing and insert that into the argument list. Something likeand then use
(or without the quotes if you need to pass more options).