I need to iterate lines in a file. Following command doesn’t work:
set filename=c:\program files (x86)\somewhere
...
for /f "delims==" %%i in (%filename%) do echo %%i
because of “)” in the filename. Error:
\somewhere) was unexpected at this time.
Escaping by “^” doesn’t work here because I need to use an variable instead of inline filename. How to resolve this?
Put the filename in double quotes, but also add the
usebackqoption:From the output of
FOR /?: