473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

errorlevel

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
5 4894
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
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ajay Garg | last post by:
I am running the following OSQL command and capturing the return code for the error .Whenver i have an error like server not exists or uable to login I get a return code of 1 for the...
3
by: DBA | last post by:
I have a windows batch file that executes a SQL Server bcp command. I would like to obtain a return code if the bcp command fails. However, I cannot seem to find the return code (if any) for bcp....
2
by: Bill44077 | last post by:
Hi, I have a script that I use to check to see if a machine is connected and online. I am in the process of writing a new .net app that needs this same kind of functionality. Is there any way to...
0
by: Benny Ng | last post by:
Hi,All, When i deploy Enterprise library with my application ,i used XCOPY to deploy it into my test server. But when application runs, shown some error related registry. (But actually I haven't...
13
by: Mark A. Nadig | last post by:
I've got a console application in vb.net to replicate the behavior of the old DOS command CHOICE. I've got a timer event successfully firing, however the main thread is stuck on the console.read()....
5
by: Patrick Dickey | last post by:
Hello, All! I'm modifying some source code that I downloaded from Planet-source-code a while back, and have a question about Try Catch statements. Basically, I'm wondering if I can do a Try with...
6
by: johnnyG | last post by:
Greetings, Since Main() is a subroutine in VB.NET console apps and not a function, is there a way to return a value to a script ro other "caller" for a VB.NET console .exe? sub main() like if...
2
by: Jeroen | last post by:
Here's the situation. My program will be able to start with an argument (a path to a file) and then run a batch of commands in that file. So if an argument is provided to the main method, the...
0
NeoPa
by: NeoPa | last post by:
Introduction : I have come across a problem, on a number of occasions, where PCs under my control fail to load new updates successfully. This is true whether they are attempting to apply via the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.