SFX run file after extraction depending on OS bitness

江枫思渺然 提交于 2019-12-25 16:48:54

问题


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.



来源:https://stackoverflow.com/questions/40515114/sfx-run-file-after-extraction-depending-on-os-bitness

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!