Environment: Windows 7 x64, Wix Toolset 3.10
Hello
I cannot call cmd.exe by Custom Action through Execute attribute "immediate" or "deferred" in either way.
Runtime Error always happen.
I can call vbs command by a Custom Action, but cannot fire .bat file,
What's wrong? I suppose there might be inconsistency between the path of input and output, but I cannot find it.
If I can output the log files with only English, please teach me....
In deferred action, log InstallInitialize, InstallFinalize might suggest me to do something with Orca, but I am not sure what I should do.
Below is detail of my attempt:
Following a sample suggested in https://alexanderst.wordpress.com/2010/10/28/wix-how-to-run-application-with-parameters-from-custom-action/ My definition of a property for cmd.exe below:
<Property Id="CMD">
<DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
<FileSearch Id="CmdExe" Name="cmd.exe" />
</DirectorySearch>
</Property>
My definition of a directory for a batch file below:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="FugaFuga" Name="FugaFuga">
<Directory Id="INSTALLDIR" Name="Hoge 1.0">
<Component Id="FugaFugaLibrary" Guid="MY-UID">
<File Id="test.bat" Name="test.bat" DiskId="1" Source="test.bat" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
My definition of the Publish Event DoAction is below:
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next(&N)">
<Publish Event="DoAction" Value="CallCmdTest">1</Publish>
<Publish Event="NewDialog" Value="NextDlg" />
</Control>
test.bat content is below (both of hoge.txt and temp\hoge folder exist)
copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
It simply copys the hoge.txt to a hoge{%date% without slash}.txt
I tried Execute="deferred" but Runtime Error happens when the next button is pushed.
<CustomAction Id="CallCmdTest" Property="CMD" Return="check" Execute="deferred" Impersonate="yes" ExeCommand="/c ""[#test.bat]""" />
Its log file (I'm sorry for the japanese characters...)(msiexec /i Main.msi /lv* Main-install.log result:) Error 2762 but return code is 3...
アクション開始 11:04:22: CallCmdTest。 MSI (c) (08:C0) [11:04:22:176]: Note: 1: 2762 DEBUG: Error 2762: Unable to schedule operation. The action must be scheduled between InstallInitialize and InstallFinalize. このパッケージをインストールしているときに、インストーラーに予期しないエラーが発生しました。このパッケージに問題がある可能性があります。エラー コードは、2762 です。引数: 、、 MSI (c) (08:C0) [12:03:24:486]: 製品: HogeHoge 1.12.0 -- このパッケージをインストールしているときに、インストーラーに予期しないエラーが発生しました。このパッケージに問題がある可能性があります。エ ラー コードは、2762 です。引数: 、、 アクション終了 12:03:24: CallCmdTest。 戻り値 3。
I tried Execute="immediate" but a Runtime Error happens either when the next button is pushed:
<CustomAction Id="CallCmdTest" Property="CMD" Return="check" Execute="immediate" ExeCommand="/c ""[#test.bat]""" />
Its log file (I'm sorry for the japanese characters...)(msiexec /i Main.msi /lv* Main-install.log result:) Error 2762 but return code is 3..
アクション開始 17:13:23: CallCmdTest。 MSI (c) (B8:C4) [17:13:24:034]: Note: 1: 1722 2: CallCmdTest 3: C:\Windows\SysWOW64\cmd.exe 4: /c ""C:\Program Files (x86)\HogeHoge\Hoge 1.0\test.bat"" エラー 1722。この Windows インストーラー パッケージに問題があります。セットアップの一部として実行されるプログラムが正常に完了しませんでした。サポート担当者またはパッケージ開発元に問い合わせてください。アクション CallCmdTest、場所: C:\Windows\SysWOW64\cmd.exe、コマンド: /c ""C:\Program Files (x86)\HogeHoge\Hoge 1.0\test.bat"" MSI (c) (B8:C4) [17:13:25:694]: 製品: HogeHoge 1.12.0 -- エラー 1722。この Windows インストーラー パッケージに問題があります。セットアップの一部として実行されるプログラムが正常に完了しませんでした。サポート担当者またはパッケージ開発元に問い合わせてください。アクション CallCmdTest、場所: C:\Windows\SysWOW64\cmd.exe、コマンド: /c ""C:\Program Files (x86)\HogeHoge\Hoge 1.0\test.bat"" アクション終了 17:13:25: CallCmdTest。 戻り値 3。 DEBUG: Error 2896: Executing action CallCmdTest failed. このパッケージをインストールしているときに、インストーラーに予期しないエラーが発生しました。このパッケージに問題がある可能性がありま す。エラー コードは、2896 です。引数: CallCmdTest、、 アクション終了 17:13:25: WelcomeDlg。 戻り値 3。 MSI (c) (B8:B8) [17:13:25:716]: Doing action: FatalError アクション 17:13:25: FatalError。
All files (Main.wxs, Main.wixobj, Main.msi, test.bat) exist in one folder. All commands of candle, light, msiexec are executed in the same directory.
cd /d %~dp0
candle.exe Main.wxs
light.exe -cultures:ja-jp -ext WixUIExtension -out Main.msi Main.wixobj
msiexec /i Main.msi /lv* Main-install.log