简体   繁体   English

使用 ProcessBuilder 调用多个命令

[英]Invoking multiple commands using ProcessBuilder

I am invoking ProcessBuilder with the following command-line:我正在使用以下命令行调用 ProcessBuilder:

{"cmd.exe", "/c", "C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\Tools\\..\\..\\VC\\vcvarsall.bat && msbuild"}

The process throws this exception:该过程抛出此异常:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

If I remove && msbuild the error goes away (so this isn't an issue of quoting).如果我删除&& msbuild错误就会消失(所以这不是引用问题)。 Any ideas on how to make this work?关于如何使这项工作的任何想法?

I don't have a windows machine knocking about, but my guess would be to quote the && and msbuild as separate array entries.我没有 windows 机器敲门,但我的猜测是将&&msbuild作为单独的数组条目引用。

{"cmd.exe",
"/c",
"C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\..\..\VC\vcvarsall.bat",
"&&",
"msbuild"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM