Bat文件集命令

时间:2010-07-15 11:49:02

标签: windows batch-file

我有以下

echo off
set installType = /t
set msBuild=c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
set adminBuild = %msBuild% "d:\Projects\Test\Test.csproj" /T:Package /P:PackageLocation="d:\Projects\MSBuild\Package\Test.zip"
set adminDeploy = d:\Projects\MSBuild\Package\Test.deploy.cmd %installType%
echo %msBuild%
echo %adminBuild% 
echo %adminDeploy%

第一个回声是正确的,下一回不会返回任何东西。你能告诉我什么是错的吗? 谢谢

1 个答案:

答案 0 :(得分:1)

=语句中set的任何一侧都不应有空格。

使用:

echo off
set installType = /t
set msBuild=c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
set adminBuild=%msBuild% "d:\Projects\Test\Test.csproj"...
set adminDeploy=d:\Projects\MSBuild\Package\Test.deploy.cmd %installType%
echo %msBuild%
echo %adminBuild% 
echo %adminDeploy%

产生你想要的东西:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "d:\Projects\Test\Test.csproj"...
d:\Projects\MSBuild\Package\Test.deploy.cmd