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.

- 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.


Patched source (of 7zip SFX 9.22b): main.cpp
Example of converted bat (my old app Cabit, a Cabinet archiver):

You config file should resemble:

RunProgram="/c cd /d %%W && %%T\\cabit.bat "

See original post for comment:

1 comment: