BAT to EXE

There are many bat2exe tools out there, or more appropriately a wrapper (not a compiler anyhow). But I think mine is the one that its resulting exe behave like a proper cmd apps. It's based on modified 7zip SFX module.

Behavior:
- Can be passed command arguments
- Can be called (and have the correct working directory) from anywhere inside PATH environment
- Do not spawn new cmd box if called from existing cmd box.
- Provide %%W as corrected %CD% at RunProgram
- Provide %%S as corrected %~dp0 at RunProgram

Additionally, it's also possible (need source code modification) to make the exe immune to "Prevent access to the command prompt" policy by changing COMSPEC internally to ReactOS's own command processor (cmd.exe) at the cost of larger exe filesize.

Download:
http://osspack32.googlecode.com/files/7zSDcon.sfx

Patched source (of 7zip SFX 9.22b): main.cpp
Example of converted bat (my old app Cabit, a Cabinet archiver):
http://osspack32.googlecode.com/files/cabit.exe

You config file should resemble:

;!@Install@!UTF-8!
RunProgram="/c cd /d %%W && %%T\\cabit.bat "
;!@InstallEnd@! 


See original post for comment:
http://opensourcepack.blogspot.com/2013/04/a-simple-bat-to-exe-wrapper.html

1 comment: