正确引用 cmd.exe 的多个参数 [英] Correct quoting for cmd.exe for multiple arguments
问题描述
我要打电话
cmd /c "C:Program FilesMicrosoft Visual Studio 9.0Common7IDEdevenv.com" mysolution.sln /build "release|win32"
不幸的是这不起作用,因为我收到错误:
Unfortunately this does not work, because I get the error:
'C:Program' 不被识别为内部或外部命令,可运行的程序或批处理文件.
'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?
推荐答案
注意开头和结尾的""
!
运行一个程序并传递一个长文件名
Run a program and pass a Long Filename
cmd /c write.exe "c:sample documentssample.txt"
<小时>
程序路径中的空格
Spaces in Program Path
cmd /c ""c:Program FilesMicrosoft OfficeOfficeWinword.exe""
<小时>
程序路径+参数中的空格
Spaces in Program Path + parameters
cmd /c ""c:Program Filesdemo.cmd"" Parameter1 Param2
<小时>
程序路径中的空格+带空格的参数
Spaces in Program Path + parameters with spaces
cmd /k ""c:atch filesdemo.cmd" "Parameter 1 with space" "Parameter2 with space""
<小时>
启动 Demo1,然后启动 Demo2
Launch Demo1 and then Launch Demo2
cmd /c ""c:Program Filesdemo1.cmd" & "c:Program Filesdemo2.cmd""
这篇关于正确引用 cmd.exe 的多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!