You are not logged in.

#1 15 Mar 2007 22:46

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 121
Website

Call variables from a exe to bat?

Is this possible? I have used a third party app to encrypt a .bat file to a .exe so its contents are not able to be seen.

I have a .bat file which I wish to call a .exe compilied with QFBC, but the variables in the .exe are not passed back into the .bat

Xgames.bat

@echo off
call secretkey.exe
echo %_key%
pause

secretkey.exe

@echo off
set _key=1234

Is there a way to get the values from a .exe to a .bat?


cmd, vbs, ps, bash
autoit, python, swift

Offline

#2 16 Mar 2007 09:51

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Call variables from a exe to bat?

I think the exe must be running in a separate context, so probably not

Try swapping it round so you call the BAT from the exe

Offline

#3 16 Mar 2007 10:54

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 121
Website

Re: Call variables from a exe to bat?

That works with the software I use you can call a bat from a exe,
however I wish to leave the exe encrypted and the bat as a bat so it can be modified easily. The only way around this would be to have a temp file which recieves output from the exe variable then the bat has to load it from the temp file. So now I just have to figure how to get a variablename and its data into a temp file then load the variablename and data from there smile


cmd, vbs, ps, bash
autoit, python, swift

Offline

#4 16 Mar 2007 14:28

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Call variables from a exe to bat?

Just
SET somevar>somefile.txt

Of course you'll need to be sure this 'secret' info is saved to a secure location - similarly if you pass the info when calling the exe then it will be visible in the process list

Offline

#5 17 Mar 2007 03:25

NDog
Member
From: New Zealand
Registered: 31 May 2006
Posts: 121
Website

Re: Call variables from a exe to bat?

Sorry I don't know how to redirect the variable back into the bat i tried this though
One more question if i wanted to store about 3 different variables in the temp file, do you know how to do that?
thanks
xgames.bat

@echo off
call secretkey.exe
set _key=1<temp.file
echo %_key%
pause

secretkey.exe

@echo off
set _key=1234
set _key>temp.file

cmd, vbs, ps, bash
autoit, python, swift

Offline

#6 17 Mar 2007 14:13

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Call variables from a exe to bat?

NDog wrote:

Sorry I don't know how to redirect the variable back into the bat i tried this though
One more question if i wanted to store about 3 different variables in the temp file, do you know how to do that?
thanks

Something like this /untested

xgames.bat

@echo off
call secretkey.exe

FOR /F "tokens=1,2* delims==" %%G IN (temp.file) DO @echo [[%%G %%H %%I]]

pause

secretkey.exe

@echo off
set _key1=1234
set _key2=abcd
set _key1>temp.file
set _key2>>temp.file

Offline

Board footer

Powered by