Page 1 of 1

Compile .bat to .exe?

Posted: 11 Oct 2016 10:00
by (_osd_)
Hello,
how can one compile a .bat script to a .exe file?
Help appreciated, thanks.

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 10:04
by Squashman
(_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.

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 10:53
by ShadowThief
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.

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 11:21
by npocmaka_
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.

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 11:35
by batchcc
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?

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 11:44
by npocmaka_
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.

Re: Compile .bat to .exe?

Posted: 11 Oct 2016 12:46
by batchcc
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