calling a exe from a exe

Convert your BATch files into EXEcutable format in one click.
Post Reply
frenchrl
Posts: 4
Joined: Wed Mar 22, 2006 1:08 pm

calling a exe from a exe

Post by frenchrl »

I have compiled the following batch file to test_pswd.exe:
@for /f %%a in (c:\work_folder\password_file.txt) do @isql -Smy_server -Usa -P%%a

This works perfectly in calling the password_file.txt and runs my sql.

Now I need to compile the password_file.txt to a exe in order to hide the password.

When I do this and then run my test_pswd.exe nothing happens or I simply get the actual code from test_pswd.exe echoed back.


I have hundreds of scripts like this that I need to periodically change the password on. This requires a recompile of all my executables. It would be much easier to change it one place than in hundreds.

Any ideas, suggestions??

Thanks
support
Site Admin
Posts: 476
Joined: Fri Feb 13, 2004 1:05 pm

Post by support »

I have only one idea:

1. change "password_file.txt" to "password_file.bat" and
replace your password with something like this:

if "%1"="secretkey" echo "your password"

Compile it.
Nobody can get your password without secret key.


2. In "test_pswd.exe"

set /p mypassword=< password_file.exe "secretkey"
@call isql -Smy_server -Usa -P%mypassword%
frenchrl
Posts: 4
Joined: Wed Mar 22, 2006 1:08 pm

Post by frenchrl »

support wrote:I have only one idea:

1. change "password_file.txt" to "password_file.bat" and
replace your password with something like this:

if "%1"="secretkey" echo "your password"

Compile it.
Nobody can get your password without secret key.


2. In "test_pswd.exe"

set /p mypassword=< password_file.exe "secretkey"
@call isql -Smy_server -Usa -P%mypassword%

Really appreciate the help, however the variable that gets passed here to the password is the entire if statement. Meaning that the %mypassword% is becoming: if "%1"="secretkey" echo "your password"

I am working with this though and trying to get it to work.

We are really in a bind here to make this work. All our batch jobs, roughly 300 of them, have to be re-compiled to do something like this soon.

Thanks for your help and time it is appreciated.
Whale
Posts: 22
Joined: Thu Sep 24, 2009 5:56 pm

Post by Whale »

Hi,
The first solution would be this below:

Code: Select all

http&#58;//www.abyssmedia.com/forum/what-makes-quick-batch-file-compiler-better-than-the-others-t458,start,15.html
But the project is put on hold for now as far as I know.

The next best thing is below:

Code: Select all

http&#58;//www.softpedia.com/get/Security/Encrypting/Codeode-Command-Line-Encrypt.shtml

http&#58;//www.softpedia.com/get/Security/Encrypting/Command-Line-Crypter.shtml

http&#58;//www.softpedia.com/get/Security/Encrypting/Krypter-Command-Line.shtml

http&#58;//www.f2ko.de/downloads/cmdtools/rc4.zip

http&#58;//www.softpedia.com/get/Programming/Other-Programming-Files/Base64-De-Encoder.shtml

http&#58;//www.techrepublic.com/article/use-cipherexe-for-command-line-encryption/

http&#58;//hcrypto.sourceforge.net/

http&#58;//technet.microsoft.com/en-us/library/bb490878.aspx

http&#58;//www.softspecialists.com/download.aspx &#40;MiCry and Xor&#41;
What I mean is encrypt the file using commandline utilities such as the above tools, windows itself provide cipher as a commandline tool too.

If you dont want to use cipher, you can use commandline tools such as the above and embedded it into your Quick Batch File Compiler compiled exe.

The last option if you have ScriptCryptor, you could
put the password in it.

Eg.

Test.vbs contains:

Code: Select all

Wscript.Echo "Password"
Compiled it into console test.exe using ScriptCryptor.

Then use something like this batch file below:

Getoutput.bat contains:

Code: Select all

@echo off
FOR /F "tokens=*" %%i in &#40;'%~dp0test.exe'&#41; do SET OUTPUT=%%i 
Echo %OUTPUT%
pause
exit
Then run Getoutput.bat, it should call test.exe, then capture its output
into the variable OUTPUT.

The Getoutput.bat should echo the OUTPUT capture result.
Whale
Posts: 22
Joined: Thu Sep 24, 2009 5:56 pm

Post by Whale »

In the end, can I know what method you use? :?:
Post Reply