r/windowsdev • u/Inner-Interest-2577 • Jul 19 '26
I made an open-source BAT-to-EXE compiler with a CRT-free Win32 runtime (14 KB)
Most BAT-to-EXE tools I found are either closed-source, outdated, or no longer actively maintained. I wanted to build a fully open implementation that anyone can inspect, modify, and build themselves.
The compiler itself is written in C++ using the Win32 API, while the runtime stub is written in C and built without the CRT using MinGW. The runtime stub is only about 14 KB, has no runtime dependencies, and supports both x86 and x64 Windows (Windows 7 and later).
Current features include:
- Resource embedding
- Custom icons and version information
- x86/x64 compiler/output
- An experimental in-memory execution mode (executing the embedded batch script through pipes)
The in-memory mode is still experimental and intentionally isn't the default. Some batch features that rely on a physical .bat file or interactive input are not fully compatible yet, so please read the documentation before using it.
The project is licensed under LGPL and I'm mainly looking for feedback, bug reports, feature suggestions, or general thoughts from people who are interested in Windows native development.
GitHub: https://github.com/LeapHeap/XBat
Thanks for taking a look!
6
u/0x80070002 Jul 19 '26
Rembds me of BAT2COM.COM in DOS times, was a fun way to make virusses for script kiddies
2
u/SchlaWiener4711 Jul 20 '26
„Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should.“
Dr. Ian Malcolm
2
u/snaphat Jul 21 '26 edited Jul 21 '26
I like the injected environmental variable feature. One of the biggest issues with most bat to exe converters is that they extract the script into a temporary directory but have no way to embed resources and/or know the executable directory.
The other big issue is false-positive AV flagging. I doubt your stub will be less prone to that, but I do wonder if there's a way to reduce false positives outside of not packing with UPX