How to run a batch file while keeping the console window hidden?

I want to run my successfully installed Java program after the installation is complete. I know how to do this in principle:

[Run] FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall skipifsilent 

LaunchApp.bat:

 start javaw -jar MyJar.jar Main 

Thus, the console window appears for a short time, which is not very nice. Using links, this can be avoided. However, it seems that I can’t execute the link created in [Icon] in the [Run] section.

Any suggestions how to solve this?

+6
source share
2 answers

Try adding the runhidden flag. From the reference:

If this flag is specified, it will launch the program in a hidden window. Never use this flag when executing a program that may prompt for user input.

So this should solve your question:

 [Run] FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall runhidden skipifsilent 
+15
source

You can completely avoid the batch file and run java.exe with the appropriate parameters. This will not help the window appear when the user usually runs the batch file.

+1
source

Source: https://habr.com/ru/post/911483/


All Articles