简体   繁体   中英

Inno Setup : how to launch an executable with parameters

I have a custom Java runtime image for Windows called java.exe and I can simply execute java -jar HelloWorld.jar to run my HelloWorld application. Using Inno Setup, I want to create an installer for my HelloWorld application. I can create an installer for java.exe , but obviously it would just run my custom Java image, whereas what I want is to run java -jar HelloWorld.jar .

Does anyone know how this can be achieved? Inno Setup does not seem to support application parameters.

I found a hack, which is to create a batch file that would execute my command. The problem is that it opens an extra CMD window. I was able to overcome this using a visual basic script that calls the batch file. It works, but I wonder if there is a better way.

Based on the Inno Setup design, the way to pass parameters to the executable (Java in this case) is via the parameters configuration of the [icon] section. And using “minimized” in the Flags of the [icon] would cause the application to launch without opening any CMD windows. The only downside of using [icon] parameters is that they are visible and modifiable by right clicking on the application icon. An alternative approach is to create a.bat file, or better yet: a.exe file that calls the application with the required parameters. If using.exe, then a simple call to execv would do. There's no need to fork.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM