[英]Build a Visual Studio C++ project using the Command Line
I''ve written this batch script to build a Visual Studio C++ project using the Command Line: 我已经编写了以下批处理脚本,以使用命令行来构建Visual Studio C ++项目:
pushd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VsDevCmd.bat
pushd F:\Master_Copy2\embedded\IFV-170\visualC12
Msbuild.exe DSP1_Emu.vcxproj
The script changes to C:\\Program Files (x86)\\ ... directory, runs the VsDevCmd.bat, and then don't complete the commands, and I don't know what's wrong. 脚本更改为C:\\ Program Files(x86)\\ ...目录,运行VsDevCmd.bat,然后不完成命令,而且我也不知道这是怎么回事。
Note: When I run these commands one by one in a Command window it runs properly and builds the project. 注意:当我在“命令”窗口中一个接一个地运行这些命令时,它将正常运行并构建项目。
Edit: @roalz pointed out that I should use Call
with the batch file VsDevCmd.bat, and this solved the problem. 编辑:@roalz指出我应该将Call
与批处理文件VsDevCmd.bat一起使用,这可以解决问题。
I think you need to use the call
batch command to call VsDevCmd.bat
from inside your batch file. 我认为你需要使用call
批处理命令调用VsDevCmd.bat
从您的批处理文件中。
"The CALL command will launch a new batch file context along with any specified parameters. When the end of the second batch file is reached (or if EXIT is used), control will return to just after the initial CALL statement." “ CALL命令将启动一个新的批处理文件上下文以及任何指定的参数。当到达第二个批处理文件的末尾(或者如果使用EXIT时),控制权将在初始CALL语句之后返回。”
Please see the reference here 请在这里查看参考
Another suggestion is to enclose paths containing spaces inside double quotes, ie 另一个建议是将包含空格的路径括在双引号内,即
"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\" “ C:\\ Program Files(x86)\\ Microsoft Visual Studio 12.0 \\ Common7 \\ Tools \\”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.