MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Immediate Custom Actions[Next]: Database Tables
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Windows Installer FAQ (the basics)->Custom Actions->Hide the DOS Command Window

Hide the DOS Command Window

When invoking a custom action a Windows console window may sometimes also appear depending on the type of process being invoked.

Some external pages on this subject are:

The following code sets up a test bed which will be used as a basis for tests of individual programs mentioned below as well as demonstrating the issue:

;--- Create VBS which will be invoked via CSCRIPT (generating "DOS Window") ---
<$FileMake "out\MsgBox.VBS">
    <?SyntaxCheck>
    '--- We will run via cscript to test "DOS Window" problem ---
    Title = "Testing 'DOS Window'...."
    Text = wscript.arguments(0) & vbCRLF & vbCRLF & "Do you want me to return RC=0 for success?"
    Yn   = MsgBox(Text, vbYesNoCancel+vbQuestion+vbDefaultButton1+vbSystemModal, Title)
    if  Yn = vbYes then
        wscript.quit 0
    else
        wscript.quit 1234
    end if
<$/FileMake>
<$FileMake "out\FailAtEndToPreventInstall.VBS">
        <?SyntaxCheck>
        msgbox "Abort to cause install failure (rollback)", vInformation, "TESTS COMPLETE"
        wscript.quit 999        'Don't want MSI to install (makes testing easier)!
<$/FileMake>
<$Files "out\MsgBox.VBS"                         DestDir="[INSTALLDIR]">
<$Files "out\FailAtEndToPreventInstall.VBS"      DestDir="[INSTALLDIR]">


;--- Generate FIRST/LAST Custom Actions -------------------------------------
#(
  <$ExeCa
           EXE=^[SystemFolder]cscript.exe^
          Args=^"[INSTALLDIR]MsgBox.vbs" "Test #1 - WINDOW IN BACKGROUND"^
     Condition=^<$CONDITION_INSTALL_ONLY>^
           Seq="StartServices-"
          Type="Rc0"
  >
#)
#(
  <$ExeCa
           EXE=^[SystemFolder]Wscript.exe^          ;;Don't want "DOS Window" (not testing)
          Args=^"[INSTALLDIR]FailAtEndToPreventInstall.VBS"^
     Condition=^<$CONDITION_INSTALL_ONLY>^
           Seq="<-RegisterUser"
          Type="Rc0"                                ;;We will get non-zero return code
  >
#)

Please note that the use of "CSCRIPT.EXE" was simply to demonstrate (create) the problem, to remove the window if thats what I wanted I'd have use "WSCRIPT.EXE"!

If you tried the above code the first message box comes up over a (normally black) command window. You can choose if return code 0 is returned to simulate success or failure of your custom action, some of the programs listed below do not correctly handle the return code, this doesn't matter if the invoked process is also that "lame".

I have listed all programs I have located here as some will have other switches or features which at times you might also need such as the setting of process priority. At the end of the day you will have to "suck it and see", what works in one situation may be useless in another.

Tested Methods


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Immediate Custom Actions[Next]: Database Tables


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday November 17 2013 at 1:19pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.