Batch to Exe

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
FoozFx
Posts: 1
Joined: 15 May 2014 03:32

Batch to Exe

#1 Post by FoozFx » 15 May 2014 03:37

Hi guys im new here :) . I will need an advice what to do because i have a problem . So i have a .bat file which function is to connect to ftp server , download and execute file . So i wrote the script "which is really easy" and ran it . So when it stays at .bat and if i run it as administrator it works fine but if i compile it to .exe it not works. So i want to make it exe because i want no 1 to be able to view the source code . So no matter do I use Bat To Exe Converte or Advanced BAT to EXE it still not works . so this is my script :
@echo off
@ftp -i -s:"%~f0"&GOTO:EOF
open IP
user
password
get ***/*/test.exe
disconnect
! start test.exe
--------------------------------
Again when it is batch file it works when compile to exe , no works . Please help :)

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

Re: Batch to Exe

#2 Post by Squashman » 15 May 2014 08:04

Well if you understand how most of the Batch to Exe programs work you would probably know what the problem is.

Use this code as a test.

Code: Select all

@echo off
dir /a-d /b
echo "%~f0"
pause

Run it as a batch file and look at the output.
Then make it an exe with one of your Bat to Exe programs and run the exe and loook at the output.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch to Exe

#3 Post by penpen » 15 May 2014 08:51

I think "compiling" such programs is of more fun, as some bat2exe... have "patched" the output of your test:

Code: Select all

@echo off
call :viewSource
goto :eof

:viewSource
["%~dpfn0"]
type "%~dpfn0"
echo [eof]
pause
(SUB characters may "confuse" the type command)

penpen

Edit: This may also help you: http://www.dostips.com/forum/viewtopic.php?p=28817#p28817.

VSom007
Posts: 1
Joined: 21 Apr 2014 03:46

Re: Batch to Exe

#4 Post by VSom007 » 15 May 2014 09:19

Hi All,
Is there any way to make .bat as .exe apart from bat to exe converters so that no1 will be able to look its code?
My primary motive is to hide code? whether it is .bat or .exe.. Help is highly appreciated.

Thanks,
viksom007

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch to Exe

#5 Post by penpen » 15 May 2014 10:03

As far as i know, no matter what bat2exe converter you use, there's always a way to see the source,
if you know how to find the temporary batch file (very easy).

You may obfuscate the source using the technique dbenham has used in one of his games (ROT13):
http://www.dostips.com/forum/viewtopic.php?f=3&t=4876.
But although this is the best technique i've seen to do this, it is no hard task to decrypt it.

So i think you could say: It is impossible to hide the code from any user (who wants to know the source).

penpen

Post Reply