为什么第二个命令没有在BAT文件中启动

时间:2015-03-11 10:38:14

标签: batch-file cmd

当我首先在cmd.exe中跑步时

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"

然后

start MSBuild.exe /t:BatchRebuild /p:Configuration=Debug /noautoresponse "C:\Users\developer\Documents\Visual Studio 2013\Projects\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1.csproj"

然后两个命令都成功执行。

但是当我把它们写入BAT - 文件时 - 第二个命令没有启动:

:: This script builds your project for all target AutoCAD versions, are pointed
:: in the "BuildFor" property of your csproj-file.
:: WARNING If you will rename your csproj-file later, then don't forget to do 
:: the same in this file (look last parameter of the msbuild command below).

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" 

start MSBuild.exe /t:BatchRebuild /p:Configuration=Debug /noautoresponse "C:\Users\developer\Documents\Visual Studio 2013\Projects\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1.csproj"

为什么会这样?我该如何解决?

2 个答案:

答案 0 :(得分:2)

工作变体(必须为其他BAT文件执行添加call):

:: This script builds your project for all target AutoCAD versions, are pointed
:: in the "BuildFor" property of your csproj-file.
:: WARNING If you will rename your csproj-file later, then don't forget to do 
:: the same in this file (look last parameter of the msbuild command below).

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" 

MSBuild.exe /t:BatchRebuild /p:Configuration=Debug /noautoresponse "C:\Users\developer\Documents\Visual Studio 2013\Projects\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1\AutoCAD_Net_Extension1.csproj"

答案 1 :(得分:0)

Start的引号中的第一个参数必须是windowtitle。把一个空白的。

Start "" rest of command line