Computing.Net > Forums > Disk Operating System > Variables in batch files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Variables in batch files

Reply to Message Icon

Name: sankar
Date: December 6, 2002 at 02:43:18 Pacific
OS: drdos
CPU/Ram: p4 - 128
Comment:

sir
how i can use variables in batch files

i need to receive return values from c -exe files to batch file variables and i want to
check the values in the batch files



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: January 21, 2003 at 14:56:08 Pacific
Reply:

Hi Sankar
If have you written the C programs yourself, if so your could output
as many variables as you like, using the code below. If youre not sure how it works send me a email.


[CProgram]
#include

main() {
printf("BatchFile.bat %d",ReturnValue);
}
[End CProgram]


[BatchFile.bat]
@echo off
if not (%1)==() goto Var
echo @echo off >tmp.bat
CProgram.exe >> tmp.bat
tmp.bat
:Var
set XVar=%1;
del tmp.bat
[End BatchFile.bat]


0

Response Number 2
Name: dtech10
Date: January 22, 2003 at 14:19:36 Pacific
Reply:

Hi Sankar
I've found a better way way to recieve return values from your c programs.
I've just echoed the values to the sceeen just so that you can test it's working ok.

@echo off
c-Prog1.exe
rem Note errorlevel only supports 1 byte
rem values from 0 to 255
rem errorlevel=12
if errorlevel 12;if not errorlevel 13 echo %errorlevel%
c-Program2.exe
rem errorlevel=5
if errorlelel 5;if not errorlevel 6 echo %errorlevel%
ect.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Variables in batch files

Batch File Variables www.computing.net/answers/dos/batch-file-variables/14203.html

What does the % mean in batch files? www.computing.net/answers/dos/what-does-the-mean-in-batch-files/5925.html

Operating system variable in batch file? www.computing.net/answers/dos/operating-system-variable-in-batch-file/8774.html