Search code examples
windowscmd

Escape double quotes in parameter


In Unix I could run myscript '"test"' and I would get "test".

In Windows cmd I get 'test'.

How can I pass double-quotes as a parameter? I would like to know how to do this manually from a cmd window so I don't have to write a program to test my program.


Solution

  • I cannot quickly reproduce the symptoms: if I try myscript '"test"' with a batch file myscript.bat containing just @echo.%1 or even @echo.%~1, I get all quotes: '"test"'

    Perhaps you can try the escape character ^ like this: myscript '^"test^"'?