-->

SFX run file after extraction depending on OS bitn

2019-09-13 12:37发布

问题:

I need to create self-extracting archives that, once extracted, run different executables depending on the bitness of the Operating System.

Until now, I have done this by use of WinRAR and BAT files but the quick flash of the Command Prompt window prior to the main application's window looks suspicious.

So, I'm looking for a better option but have yet to find one.

回答1:

You could code a 32-bit GUI application in C/C++/C# not opening a window which for example determines with getenv_s or getenv if variable ProgramFiles(x86) exists (only on 64-bit Windows) and starts next the appropriate main application. This executable is compressed into the SFX archive and executed by the SFX archive.

Or you code your own SFX module. The sources for unpacking a RAR archive can be downloaded from RARLAB.

Or you code a Windows script for determining bit width of Windows and starting the appropriate main application and execute this script by the SFX archive with wscript.exe which does not open a console window like its counterpart cscript.exe.

Or you create a 64-bit SFX which can be run only on 64-bit Windows and a 32-bit SFX which can be run on 32-bit and also 64-bit Windows and offer both for download. Most users of 64-bit Windows will most likely download the 64-bit version.



标签: winrar sfx