Command line passing quotes within quotes

2019-04-22 20:46发布

I've been searching for a solution to this but couldn't find one. Not sure if its possible.

Can I pass into command-line execution that passes a in a bat file which has an input file as its arguments?

So from the command-line it'll look like this:

C:\run.exe "C:\space folder\run.bat "C:\space folder\input.txt""

The problem is with the folders that has spaces so the quotes are required to be in there.

2条回答
做自己的国王
2楼-- · 2019-04-22 21:38

Try this:

C:\run.exe "C:\space folder\run.bat \"C:\space folder\input.txt\""

And here is a link that you can see all escape characters http://www.robvanderwoude.com/escapechars.php

查看更多
淡お忘
3楼-- · 2019-04-22 21:44

I know it's an old topic, but I found the answer and would like to share.

In Windows you don't have to escape the quotes. Just use them normally.

In this case:

C:\run.exe ""C:\space folder\run.bat" "C:\space folder\input.txt""

查看更多
登录 后发表回答