Compile .bat to .exe?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
(_osd_)
Posts: 25
Joined: 01 Mar 2015 07:41

Compile .bat to .exe?

#1 Post by (_osd_) » 11 Oct 2016 10:00

Hello,
how can one compile a .bat script to a .exe file?
Help appreciated, thanks.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Compile .bat to .exe?

#2 Post by Squashman » 11 Oct 2016 10:04

(_osd_) wrote:Hello,
how can one compile a .bat script to a .exe file?
Help appreciated, thanks.

This topic has been covered dozens of times on the forums.

A quick google search for bat to exe site:dostips.com will find you all the discussions about it on dostips.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Compile .bat to .exe?

#3 Post by ShadowThief » 11 Oct 2016 10:53

Don't. Just... don't.

If you are doing this to obfuscate your code, just use a language that needs to be compiled. There's no valid reason to ever convert .bat to .exe.

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Compile .bat to .exe?

#4 Post by npocmaka_ » 11 Oct 2016 11:21

Most probably you've already hit this -> http://stackoverflow.com/questions/2817 ... arty-tools ?
and this -> http://www.f2ko.de/en/b2e.php ?

though there's no way to 'compile' bat to exe - all the tools just create a temp file somewhere and and then call it.

batchcc
Posts: 139
Joined: 17 Aug 2015 06:05
Contact:

Re: Compile .bat to .exe?

#5 Post by batchcc » 11 Oct 2016 11:35

By going to the %tmp% folder the batch file should be in a sub folder so compiling it only protects the code from people that don't know this.
Also I when I used an online compiler it added the line

Code: Select all

Shift /0

To the top does anyone know why?

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Compile .bat to .exe?

#6 Post by npocmaka_ » 11 Oct 2016 11:44

batchcc wrote:By going to the %tmp% folder the batch file should be in a sub folder so compiling it only protects the code from people that don't know this.
Also I when I used an online compiler it added the line

Code: Select all

Shift /0

To the top does anyone know why?


probably the call includes the name of the file and with shift /0 they strip the first argument.

batchcc
Posts: 139
Joined: 17 Aug 2015 06:05
Contact:

Re: Compile .bat to .exe?

#7 Post by batchcc » 11 Oct 2016 12:46

npocmaka_ wrote:
batchcc wrote:By going to the %tmp% folder the batch file should be in a sub folder so compiling it only protects the code from people that don't know this.
Also I when I used an online compiler it added the line

Code: Select all

Shift /0

To the top does anyone know why?


probably the call includes the name of the file and with shift /0 they strip the first argument.

Thanks npocmaka

Post Reply