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
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!
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
Summary: Hello, I was just trying to set a variable to the contents of a file in a batch file. For example... I did a CD>Current_dir.txt to find out where I am.. and then want to set a CRNT_DIR=current_dir.tx...
Summary: Pop over to: http://home.mnet-online.de/horst.muc/index.html (or just hit the "Homepage" link above - not my HP, but the easiest way to set a clickable link.) and have a look at: LMOD Versatile line/l...
Summary: I have written a console application that takes in various agruments and returns a pipe delimited string. I need to first figure out how to set the response to a variable, then I think i use a for com...