WiX - CustomAction ExeCommand - Hide Console

前端 未结 4 1535
醉酒成梦
醉酒成梦 2020-12-15 04:29

We\'ve gotten a custom action that runs command-line to work as such:



        
相关标签:
4条回答
  • 2020-12-15 04:54

    You just have to add second command "exit" for cmd.exe

    ExeCommand="[SystemFolder]cmd.exe /C start MyExe.exe & exit"
    

    Hope, It helps you

    0 讨论(0)
  • 2020-12-15 05:03

    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:

    1. Creating a CustomAction DLL
    2. Calling a CustomAction in DLL (from WiX) to execute the process, by hiding the console window.
    0 讨论(0)
  • 2020-12-15 05:05

    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.

    <CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
                  Value="&quot;[#MyExecutable.exe]&quot; /arguments" Execute="immediate"/>
    <CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
                  Execute="deferred" Return="check" Impersonate="no"/>
    .
    .
    .
    <InstallExecuteSequence>
        <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"/>
        <Custom Action="QtExecDeferredExampleWithProperty" After="TheActionYouWantItAfter"/>
    </InstallExecuteSequence>
    
    0 讨论(0)
  • 2020-12-15 05:13

    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.

    0 讨论(0)
提交回复
热议问题