By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,191 Members | 2,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,191 IT Pros & Developers. It's quick & easy.

errorlevel

P: n/a
Hi all ...

I'm writing a small application that needs to run a number of console
executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by
the console executables in each case.

The shell function returns a processID which is not useful in this case.

Can anyone guide me as to how to query the ERRORLEVEL system variable?

Kind regards ...
--
Luke.
-----
There are 10 types of people in this world
Those that understand binary and those that don't
-----
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Don't worry ... Found it ...

Environment.GetEnvironmentVariables

"Luke Vogel" <not@_real_address> wrote in message
news:O5*************@TK2MSFTNGP10.phx.gbl...
Hi all ...

I'm writing a small application that needs to run a number of console
executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by the console executables in each case.

The shell function returns a processID which is not useful in this case.
Can anyone guide me as to how to query the ERRORLEVEL system variable?

Kind regards ...
--
Luke.
-----
There are 10 types of people in this world
Those that understand binary and those that don't
-----

Nov 21 '05 #2

P: n/a
"Luke Vogel" <not@_real_address> schrieb:
I'm writing a small application that needs to run a number of console
executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by
the console executables in each case.

The shell function returns a processID which is not useful in this case.


If you are using 'Process.Start' to start the executable you can use the
'Process' object's 'ExitCode' property to determine the exit code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
Hi Herfried,

I think your solution will work better.

Cheers.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
"Luke Vogel" <not@_real_address> schrieb:
I'm writing a small application that needs to run a number of console executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by the console executables in each case.

The shell function returns a processID which is not useful in this
case.
If you are using 'Process.Start' to start the executable you can use the 'Process' object's 'ExitCode' property to determine the exit code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 17 '05 #4

P: n/a
Hi Herfried,

I've tried what you suggested ...

The application test shell I've written runs a couple of simple batch
files to return errorlevels.

These are started as processes, but by the time I query the ExitCode
property of the process, it throws an exception because the process has
already terminated(I assume).

The errormessage suggests that "there is no process associated with this
object".

Any ideas?

Luke


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
"Luke Vogel" <not@_real_address> schrieb:
I'm writing a small application that needs to run a number of console executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by the console executables in each case.

The shell function returns a processID which is not useful in this
case.
If you are using 'Process.Start' to start the executable you can use the 'Process' object's 'ExitCode' property to determine the exit code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 17 '05 #5

P: n/a
Don't worry ... all figured out.

Thank you all for your help this year.

I've asked a number of questions from time to time, and have always
received prompt and effective assistance.

Many thanks to all.

Luke.


"Luke Vogel" <not@_real_address> wrote in message
news:eo*************@TK2MSFTNGP15.phx.gbl...
Hi Herfried,

I've tried what you suggested ...

The application test shell I've written runs a couple of simple batch
files to return errorlevels.

These are started as processes, but by the time I query the ExitCode
property of the process, it throws an exception because the process has already terminated(I assume).

The errormessage suggests that "there is no process associated with this object".

Any ideas?

Luke


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
"Luke Vogel" <not@_real_address> schrieb:
I'm writing a small application that needs to run a number of console executables.

No problem, I can use the 'shell' function with all its useful
parameters to run each console app.

My problem is that I need to react to the ERRORLEVEL that is returned by the console executables in each case.

The shell function returns a processID which is not useful in this

case.

If you are using 'Process.Start' to start the executable you can use

the
'Process' object's 'ExitCode' property to determine the exit code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Dec 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.