CALL problem

Convert your BATch files into EXEcutable format in one click.
Post Reply
NDog
Posts: 4
Joined: Fri Oct 06, 2006 11:26 pm

CALL problem

Post by NDog »

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

Code: Select all

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

Code: Select all

@echo off
set _key=1234
Is there a way to get the values from a .exe to a .bat? Please help thanks :roll:
support
Site Admin
Posts: 476
Joined: Fri Feb 13, 2004 1:05 pm

Post by support »

Sorry, but this is impossible. This is a main difference between EXE files and scripts.
overkill
Posts: 5
Joined: Tue Apr 24, 2007 10:06 pm

Post by overkill »

try this:

Code: Select all

@echo off
secretkey.exe
echo %_key%

echo Press the any key to continue
pause > STFU
del STFU
NDog
Posts: 4
Joined: Fri Oct 06, 2006 11:26 pm

Post by NDog »

Okay overkill, very funny :lol:

Anyway I have a way of doing this, but it requires a temp file to output the variables into a text file, then load it back into the main script. Its not 100% safe, but you can put the temp file in a secure location and delete it immediately.

xgames.bat

Code: Select all

@ECHO OFF&CLS

SET LOCALKEYSHARE=C:\Keys
SET CALLKEY=call.k
SET CDKEYLOADER=steamkey.exe

CALL "%CDKEYLOADER%"
FOR /F "USEBACKQ TOKENS=1* DELIMS==" %%G IN ("%LOCALKEYSHARE%\%CALLKEY%") DO SET %%G=%%H
DEL "%LOCALKEYSHARE%\%CALLKEY%"
steamkey.exe

Code: Select all

@ECHO OFF
IF "%GAME%"=="" EXIT
IF "%NUMBER%"=="" EXIT

SET LICENSES=3

GOTO %NUMBER% 2>nul >nul
GOTO ENDKEY

:1
SET USERKEY=hexfudmn&SET PASSKEY=bag8&SET ID=25445
GOTO ENDKEY
:2
SET USERKEY=digdoliv&SET PASSKEY=sew7&SET ID=253862
GOTO ENDKEY
:3
SET USERKEY=crjanooadiob&SET PASSKEY=wa9ef&SET ID=25386
GOTO ENDKEY

:ENDKEY
SET LICENSES>"%LOCALKEYSHARE%\%CALLKEY%"
SET USERKEY>>"%LOCALKEYSHARE%\%CALLKEY%"
SET PASSKEY>>"%LOCALKEYSHARE%\%CALLKEY%"
SET ID>>"%LOCALKEYSHARE%\%CALLKEY%"
FOR /F "USEBACKQ TOKENS=1* DELIMS==" %%G IN ("c:\Keys\call.k") DO SET %%G=%%H supports long file names, and it simply loads all the variables from the text file, and you can see on the next line I delete the temporary file. So its a work around.
Post Reply