How can I run a batch file on uninstall with wix toolset 5? #8776
-
I need to run a batch file when uninstalling (ideally silently). I have tried the following, but it doesn't work. <Binary Id="DeleteRegistryKeysBatch" SourceFile="delete_explorer_context_menu.bat" />
<CustomAction Id="RemoveImageSortKeys" BinaryRef="DeleteRegistryKeysBatch" ExeCommand="" Execute="deferred" Return="ignore" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize" Condition="(AUTOSTART=1)" />
<Custom Action="RemoveImageSortKeys" After="RemoveFiles" Condition="(NOT UPGRADINGPRODUCTCODE)"/>
</InstallExecuteSequence> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Did you try to run it in the Execommand via a cmd or a start? |
Beta Was this translation helpful? Give feedback.
-
I have found a way, though it shows a command line window to the user, which isn't particularily desirable. First, I have added the script to the installation folder: <Component Id="DeleteExplorerShortcuts" Guid="c601f684-d128-41b9-b3e6-153147942f67">
<File Id="DeleteExplorerShortcutsScript" Name="delete_explorer_context_menu.bat"
Source="delete_explorer_context_menu.bat" KeyPath="yes" />
</Component> Then I have referenced it for the custom action instead: <CustomAction Id="RemoveImageSortKeys"
FileRef="DeleteExplorerShortcutsScript"
ExeCommand=""
Execute="deferred"
Return="ignore"
Impersonate="no" /> The rest stays like above. This will now execute on uninstall (and if I understand correctly NOT on upgrades, which also triggers RemoveFiles). |
Beta Was this translation helpful? Give feedback.
I have found a way, though it shows a command line window to the user, which isn't particularily desirable. First, I have added the script to the installation folder:
Then I have referenced it for the custom action instead:
Th…