BAT to EXE converter for Windows 10

Tek Info
Tek Info used Ask the Experts™
on
I am looking for a .bat to .exe converter for Windows 10
Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Robert RComputer Service Technician

Commented:
you dont really need a convert, all you need to do is rename the bat file with an exe extension, or exe to bat. then you are done no need to have an app that does that, because by time you launch the app you could have easlily renamed the file to either a bat or exe file.
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
My question would be "Why?".

Most BAT to EXE conversion tools end up creating a temp BAT file when the resulting EXE is executed, so if you are trying to hide something in the BAT from anyone seeing it you will not accomplish that completely.  If someone wants to see what was in the BAT and works at it a bit they likely will be able to...


»bp
NVITEnd-user support

Commented:
Maybe to keep out casual snoopers 🤷
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
The "why" question is a very good one, but since we haven't heard back from you on it, I'll take a run at this, making a few assumptions:

(1) You want the user not to see the command prompt dialog (i.e., hide it). This is doable.

(2) You want the user not to see the batch commands running. Of course, this is doable...simply put echo off in the batch file.

(3) You want the user not to be able to decrypt the EXE, thereby seeing what is in it. This is not doable...at least, not easily. However, I'll propose an easy method that will stop many/most users from being able to do the decryption, but will not stop an expert, who will be able to run a tool that decrypts the EXE.

The solution that I'm proposing is a very simple AutoHotkey script that is compiled into a stand-alone EXE with the AutoHotkey compiler, as I discuss in this EE article:
AutoHotkey - Getting Started

Here's the AutoHotkey script:

BatchFile:=A_Temp . "\DestBatchFileName.bat" ; destination - name it whatever you want and put it wherever you want on user's computer - A_Temp is the Windows temp folder
FileInstall,c:\temp\SourceBatchFileName.bat,%BatchFile%,1 ; install your batch file on user's computer
RunWait,%BatchFile%,,Hide ; run batch file, hiding command prompt window, and wait for it to finish
FileDelete,%BatchFile% ; delete batch file after it runs - this is a permanent delete, i.e., it does not go to the recycle bin (the FileRecycle command does that)
ExitApp

Open in new window

I hope that my comments on the code make it easy to understand. Also, the documentation on all the commands at the AutoHotkey site is very good.

Keep in mind that the AutoHotkey "compiler" is not a compiler in the normal sense, i.e., it does not create object code from your script. Rather, it packages the AutoHotkey interpreter along with your script's source code into an EXE file. Therefore, in order to make it difficult to see the source code, you should use either MPRESS or UPX encryption when compiling, both of which are natively supported by the AutoHotkey compiler...simply put mpress.exe or upx.exe in the Compiler subfolder after installing AutoHotkey (otherwise, you can see the source code by loading the EXE into any text editor). This is what I meant by stopping many/most users from being able to do the decryption, but not an expert, who will likely be able to figure out how to decrypt it.

Also, there are other "holes" in this method, such as the user stopping the script's execution before it has a chance to delete the batch file, but that's unlikely, unless your batch file runs for a long time, in which case it becomes a very likely possibility. In any event, perhaps this approach will be good enough for your purpose...whatever that purpose is. :)

Regards, Joe

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial