Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I want to start my successfully installed Java program after the installation finished. I know how to do it in principle:

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

LaunchApp.bat:

start javaw -jar  MyJar.jar Main

This way, the console window pops up for a short while, which is not very nice. Using links, this can be avoided. However, I don't seem to be able to execute a link created in the [Icon] in the [Run] section.

Any suggestions how to solve this?

like image 997
mort Avatar asked Mar 23 '12 09:03

mort


People also ask

How do I hide the batch console?

The most simple solution is to run the batch file minimized. The batch file will still be visible in the task bar while running. For batch file started by a shortcut, this may be "sufficiently hidden". See this JSIFaq tip on how to make a batch file start another batch file hidden (uses a temporary VBScript file).

How do I keep the console open after executing a batch file?

Edit your bat file by right clicking on it and select “Edit” from the list. Your file will open in notepad. Now add “PAUSE” word at the end of your bat file. This will keep the Command Prompt window open until you do not press any key.

How do I close a batch file without closing the window?

Batch file processing ends when execution reaches the end of the batch file. The trick therefore is to use the goto command to jump to a label right before the end of the file, so that execution “falls off the end”.


1 Answers

Try to add 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 resolve your question:

[Run]
FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall runhidden skipifsilent
like image 172
TLama Avatar answered Oct 06 '22 00:10

TLama