Computing.Net > Forums > Disk Operating System > set variable to output of program

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.

set variable to output of program

Reply to Message Icon

Name: Epea
Date: January 10, 2001 at 11:31:38 Pacific
Comment:

I am trying to run an executable in a batch file that returns a value. I would like to be able to set this return value to a variable in the batch file so I can pass it to other executables within the batch file. Any help or suggestions would be greatly appreciated. Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: Manish
Date: January 10, 2001 at 11:45:06 Pacific
Reply:

One way to do this (its a messy way) is to use statements like

MYPROG
IF ERRORLEVEL 5 SET MYERROR=5
IF ERRORLEVEL 4 SET MYERROR=4
.
.
etc.

Another way is to use some utilities of the sort that were distributed with packages like 4DOS or Norton DOS - they were designed to do exactly what you want.


0

Response Number 2
Name: Laurence
Date: January 10, 2001 at 11:56:46 Pacific
Reply:


Check out my FAQ!

Batfiles: The DOS batch file programming handbook



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: set variable to output of program

Set variable to contents of a file. www.computing.net/answers/dos/set-variable-to-contents-of-a-file/13420.html

output of dir to variable www.computing.net/answers/dos/output-of-dir-to-variable/14171.html

Batch Files: set variable to output www.computing.net/answers/dos/batch-files-set-variable-to-output/16926.html