Command line passing quotes within quotes

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 02:43:40

问题


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.


回答1:


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




回答2:


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""



来源:https://stackoverflow.com/questions/20484428/command-line-passing-quotes-within-quotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!