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?
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).
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.
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”.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With