How to execute .bat file without opening console window using wix custiom action

645 Views Asked by At

Am executing .bat file in custom action using wix. When i run the set up it successfully exceuting .bat file but with console window. I don't want any console window. It is possibe to hide window using wix or with .bat file.

Thanks in Advance

2

There are 2 best solutions below

5
On

You can do:

start program args
exit

but this will open command line window for just a moment, until the program starts, afterwhich it closes. Alternatively, and equivalently, you can do:

Start ""  "program args"

So, to start notepad and then exit the cmd terminal, you'd do:

start notepad
exit

or:

Start "" "notepad"
0
On
  1. Create a new text file with a .vbs extension, for example, run_invisible.vbs.
  2. Open the .vbs file with a text editor and add the following code:

Set objShell = CreateObject("WScript.Shell") objShell.Run "Your_bat_file_path", 0, True Replace "your_batch_file.bat" with the path to your actual batch file.

  1. Save the .vbs file.
  2. now you can double click the .vbs file(not the .bat file) to run your batch file without displaying the console window.