Question

I am looking for a tool that will allow me to create a self extracting executable file which can take arguments. The arguments will later be passed on to the batch file that is residing within the package that the self extracting exe contains.

Here is what I would want to achieve in steps:

User types: cmd>setup.exe arg1 arg2 arg3 arg4 arg5

Expected behavior: 1) setup.exe extracts its contents to some folder 2) it then goes and executes a batch file with arg1, arg2,...arg5 arguments

Is anyone aware of a tool like that ?

Was it helpful?

Solution 2

I was able to achieve it using WinRar. So thanks for the advice. User can specify what executable to launch after files are being extracted. Command line arguments are saved in an environment variable %sfxcmd%. So if you put that environment variable right next to the executable the arguments will be passed to it. The arguments may later be passed within your executable.

OTHER TIPS

Don't know if it could help but WinRAR lets you create auto-exe-extracting files, besides it gives you the option to run some command after the extraction and/or to show you a license info in a text editor

It's also possible to do this with 7zip. I first created a .7z package, then used the "SFX modules for installers" to convert it to a self-extracting zip. This allows you to specify in a config file which file to launch after extracting. If you pass parameters to the self-extracting zip, they will be passed to the file that you specified. The downside of this approach is that there is no way to specify the icon used for the zip.

More details are available in this question

Use WinRar. The parameters can be passed using the -sp option.

http://www.winrar-tr.com/winrar/Help/ENG/html/HELPGUISFXCmd.htm

myexe.exe -spoptions

"options" will be passed to the program in the setup field of the executable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top