开发者

Bat file set command

开发者 https://www.devze.com 2023-01-07 15:52 出处:网络
I have the following echo off set installType = /t set msBuild=c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe

I have the following

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%

The first echo works开发者_如何学Go correct, next ones don't return anything. Could you tell me what's wrong? Thank you


You should not have spaces on either side of the = in your set statements.

Use:

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%

which produces what you want:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消