Computing.Net > Forums > Programming > Capturing return value in batch scr

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.

Capturing return value in batch scr

Reply to Message Icon

Name: kappian
Date: August 3, 2006 at 14:28:00 Pacific
OS: Win XP Professional
CPU/Ram: Pentium
Product: xxx
Comment:

For /F "tokens=1" %%i in (TempJobNames.txt) do (
Executing a Command to call other application
IF %ERRORLEVEL%==0 ECHO Success
IF NOT %ERRORLEVEL%==0 ECHO Failed)



Sponsored Link
Ads by Google

Response Number 1
Name: kappian
Date: August 3, 2006 at 14:31:39 Pacific
Reply:

Sorry. Forgot to add the question...

This code is not working. Errorlevel always returns 0 even if it's failure...

Am I missing something here ?

Thanks


0

Response Number 2
Name: Mechanix2Go
Date: August 4, 2006 at 02:38:18 Pacific
Reply:

"Am I missing something here ?"

I ask myself that often.

If the executable doesn't set errorlevel, there's probably not much you can do about it. If it writes any result to stdout, you could work with that.

BTW you can skip the % and ==

if errorlevel 0 echo blabla


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 3
Name: uli_glueck
Date: August 4, 2006 at 04:55:23 Pacific
Reply:

Does the command only behave like this in the for loop - or always?

uli



0

Response Number 4
Name: kappian
Date: August 4, 2006 at 07:34:27 Pacific
Reply:

It always behaves like this...Inside loop or not it always returns 0...How can I make the executable set errorlevels ?

Thanks


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 Programming Forum Home


Sponsored links

Ads by Google


Results for: Capturing return value in batch scr

How to return value from batch file www.computing.net/answers/programming/how-to-return-value-from-batch-file/17016.html

Date Routines in Batch Files www.computing.net/answers/programming/date-routines-in-batch-files/15590.html

Return two values in C language www.computing.net/answers/programming/return-two-values-in-c-language/13620.html