We've gotten a custom action that runs command-line to work as such:
<CustomAction Id="OurAction"
FileKey="OurInstalledExe.exe"
ExeCommand="our command line args"
Execute="deferred"
Return="check" />
The problem is, the user sees a console popup when the command runs.
The command line requires UAC elevation, but should not require any user interaction. We also install the file with the setup, the custom action runs After="InstallFiles".
How do we prevent the user from seeing the console?
If you have the source code of the EXE file this is what you can do. Make the EXE project Win32 Application project instead of Console Application.
If you cannot modify the source code of the EXE file, you can do this by:
There is a bit of a chicken and egg problem in that an executable has to be marked as a console app before it starts, and if you want to launch such an exe without the console popping up, it has to have its process created with the right flags. If your installer can't provide these, it is possible to use a third .exe in between. For example, the Keybase installer launches this small utility, called keybaserq.exe, in order to run persistent console apps in the background with no flashing black windows. It is open source and you can see how the Keybase installer makes use of it - no flashing console windows.
Note that if you do require UAC elevation, then you need to ensure that it's a deferred execution CA. Here's the example from the manual with command line arguments added.
You just have to add second command "exit" for cmd.exe
Hope, It helps you