Batch file Wix:在自定义操作目录中使用computername
我想使用在customaction中运行msi的计算机的名称来执行批处理文件,该批处理文件与msi文件一起部署在与computername相同的目录中 例如,在名为“MyServer”的计算机上安装msi后,目录看起来像:C:\program files\MyApp\Config\MyServer\Config.bat 我想在安装后运行Config.bat文件,所以我提出了自定义操作Batch file Wix:在自定义操作目录中使用computername,batch-file,wix,installation,Batch File,Wix,Installation,我想使用在customaction中运行msi的计算机的名称来执行批处理文件,该批处理文件与msi文件一起部署在与computername相同的目录中 例如,在名为“MyServer”的计算机上安装msi后,目录看起来像:C:\program files\MyApp\Config\MyServer\Config.bat 我想在安装后运行Config.bat文件,所以我提出了自定义操作 <CustomAction Id="CONFIGURE" Directory="INS
<CustomAction
Id="CONFIGURE"
Directory="INSTALLFOLDER\Config\[COMPUTERNAME]"
ExeCommand="Configure.bat"
Execute="deferred"
Return="ignore" />
<InstallExecuteSequence>
<Custom Action="CONFIGURE"
After="InstallFiles" />
</InstallExecuteSequence>
<CustomAction Id="SetMachineName" Property="COMPUTERNAME" Value="[ComputerName]" Execute="immediate"></CustomAction>
所以计算机名是空的
+++
最后,多亏了一个Dusan Plavak,解决方案是:
<CustomAction
Id="CONF"
Directory="INSTALLFOLDER"
ExeCommand="\Config\[ComputerName]\Configure.bat"
Execute="deferred"
Return="ignore"
HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="CONF"
After="InstallFiles" />
</InstallExecuteSequence>
您应该使用COMPUTERNAME而不是COMPUTERNAME
例如,您可以使用自定义操作将ComputerName复制到ComputerName“
<CustomAction
Id="CONF"
Directory="INSTALLFOLDER"
ExeCommand="\Config\[ComputerName]\Configure.bat"
Execute="deferred"
Return="ignore"
HideTarget="no"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="CONF"
After="InstallFiles" />
</InstallExecuteSequence>
<CustomAction Id="SetMachineName" Property="COMPUTERNAME" Value="[ComputerName]" Execute="immediate"></CustomAction>