Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file Wix:在自定义操作目录中使用computername_Batch File_Wix_Installation - Fatal编程技术网

Batch file Wix:在自定义操作目录中使用computername

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中运行msi的计算机的名称来执行批处理文件,该批处理文件与msi文件一起部署在与computername相同的目录中

例如,在名为“MyServer”的计算机上安装msi后,目录看起来像:C:\program files\MyApp\Config\MyServer\Config.bat

我想在安装后运行Config.bat文件,所以我提出了自定义操作

<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>