0

I have the following example code:

 @for /F "tokens=1,2*" %%i in ('%SystemRoot%\system32\reg query "some key" /v "some value"') DO (
    echo "inside for"
)

I'd like to use double quotes like this: "%SystemRoot%\system32\reg" in case there was a space character in that path, but FOR doesn't like it. How can I resolve this? Thank you!

Harry
  • 89
  • 1
  • 1
  • 6
  • Just as additional information, you could replace `%SystemRoot%\System32\reg` with `%__AppDir__%Reg.exe`. I have added the file extension, because if you are having to provide the full path to the System32 directory there is likely an issue with `%Path%` which could bring about doubt regarding `%PATHEXT%`. – Compo Mar 31 '17 at 18:13
  • `@for /F "tokens=1,2*" %%i in ('^""%SystemRoot%\system32\reg.exe" query "some key" /v "some value"^"') do @echo "inside for"` – aschipfl Apr 01 '17 at 11:31
  • Thank you MC ND, Compo, aschipfl for your time. This has helped me. – Harry Apr 04 '17 at 14:21

0 Answers0