正确引用多个参数的cmd.exe [英] correct quoting for cmd.exe for multiple arguments
问题描述
我要呼叫
cmd / cC:\Program Files \ Microsoft Visual Studio 9.0 \Common7\IDE\devenv.commysolution.sln / buildease | win32
不幸的是,这不工作,因为我得到错误:
'C:\Program'不被识别为内部或外部命令,
可操作的程序或批处理文件。 p>
根据我的理解,我需要为|的空格和引号引用,但我只允许使用引号一次。
任何想法如何正确引用此命令行调用?
注意
运行程序并传递长文件名
cmd / c write.exec:\sample documents\sample.txt
程序路径中的空间
cmd / cc:\Program Files \ Microsoft Office \Office\Winword.exe
$ b b
程序路径+参数中的空格
cmd / c c:\Program Files\demo.cmdParameter1 Param2
程序路径中的空格+带空格的参数
cmd / kc:\batch files\ demo.cmd参数1与空格参数2与空格
启动Demo1,然后启动Demo2
cmd / cc:\Program Files\demo1 .cmd& c:\Program Files\demo2.cmd
I want to call
cmd /c "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" mysolution.sln /build "release|win32"
Unfortunately this does not work, because I get the error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
As I understand, I need quoting for the spaces and quotes for the |, but I am only allowed to use the quotes once.
Any ideas how to quote this command line call correctly?
Note the ""
at the beginning and at the end!
Run a program and pass a Long Filename
cmd /c write.exe "c:\sample documents\sample.txt"
Spaces in Program Path
cmd /c ""c:\Program Files\Microsoft Office\Office\Winword.exe""
Spaces in Program Path + parameters
cmd /c ""c:\Program Files\demo.cmd"" Parameter1 Param2
Spaces in Program Path + parameters with spaces
cmd /k ""c:\batch files\demo.cmd" "Parameter 1 with space" "Parameter2 with space""
Launch Demo1 and then Launch Demo2
cmd /c ""c:\Program Files\demo1.cmd" & "c:\Program Files\demo2.cmd""
这篇关于正确引用多个参数的cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!