0

I want to create a self-extracting file (SFX) named Setup.exe which contains a Windows application with some dependencies.

It is possible to start the Windows application with arguments, and I would like to put them at my Setup.exe and then it should pass them to the Windows application. Furtermore, I would like to pass the Windows application exit code to the Setup.exe.

Currently I have tried to use 7zip, but it seems that it isn't sufficient.

Is it even possible with 7z or do you know how to do with other tools?

JerryA
  • 153
  • 1
  • 8

2 Answers2

1

You've asked a lot of questions and I am trying to answer a few here, maybe not all of them.

Yes it is possible to start a Windows Application with arguments. Ideally for that you need to open command prompt and navigate to the directory of your application then type in theProgramName.exe - arguments options but that I assume you already know.

Another approach would be to Create ShortCut for the Program you are targeting and then you can just Right click -> Properties -> and append your arguments to the Target field. Example : C:\Games\Counter-Strike\hl.exe -steam -game cstrike -noforcemparms -noforcemaccel

Another approach that I assume you would want when you are creating a SFX is to create a .bat (batch) file with the contents being theProgramName.exe - arguments options and put it in the same directory as your program and set it to run as our main application when it extracts. If you want the exe and not the bat you can use some bat to exe conversion tools, there are tons out there.

The best way I can think of is using programs like Advanced Installer. You can directly make an msi or a sfx and send a shortcut anywhere (more than one) and it could contain arguments you specify just like what I described in the second way.

So yeah that other tool I'd vouch for that will do what I think you want to do is Advanced Installer.

Rishav
  • 3,818
  • 1
  • 31
  • 49
0

After some experiments, I changed the implementation so instead of using 7 zip to create a SFX I just embed all I need like *.msp and such as embedded resources in my Windows application. On that way my arguments and return code worked out of the box.

I used this link to do actual implementation: https://www.telerik.com/blogs/how-to-merge-assemblies-into-wpf-application

JerryA
  • 153
  • 1
  • 8