mort
mort

Reputation: 13588

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?

Upvotes: 8

Views: 8191

Answers (2)

TLama
TLama

Reputation: 76693

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

Upvotes: 18

Deanna
Deanna

Reputation: 24273

You could avoid the batch file altogether and run java.exe with the appropriate parameters. This won't help the window appearing when the user runs the batch file normally though.

Upvotes: 1

Related Questions