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
----- 5 4905
Don't worry ... Found it ...
Environment.Get EnvironmentVari ables
"Luke Vogel" <not@_real_addr ess> wrote in message
news:O5******** *****@TK2MSFTNG P10.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 -----
"Luke Vogel" <not@_real_addr ess> 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/>
Hi Herfried,
I think your solution will work better.
Cheers.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. . "Luke Vogel" <not@_real_addr ess> 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/>
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******** *******@TK2MSFT NGP10.phx.gbl.. . "Luke Vogel" <not@_real_addr ess> 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/>
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_addr ess> wrote in message
news:eo******** *****@TK2MSFTNG P15.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******** *******@TK2MSFT NGP10.phx.gbl.. . "Luke Vogel" <not@_real_addr ess> 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/>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 %ERRORLEVEL%.However
whenever I have an errorof a wrong dbcompatibility error the retun
code id 1 even though sql returns an iformation message from OSQL that
the right copatibilty levels are 60,70 and 80.How can i get OSQL to
return the right return code...
|
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. For example,
if the bcp command is improperly formatted, or has a bad password, I
want the batch file to return an error. Right now, my batch file
simply executes and returns success, even when the bcp command fails.
Has anyone run into this...
|
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 achieve this? This script uses
ping but if something else can provide the same kind of info that would be
great.
Echo %1
PING %1 -n 1 > PING.CHK
|
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 any method or component to wrote
registry)
After I used "InstallUtil" to registry Enterprise Library (those DLLs)
to the deployment server, the application runs smoothly.
Now I wonder why i need to registry those Enterprise Library DLLs into
|
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(). How
can I interrupt that and have it return the default errorlevel?
Any suggestions? I appreciate your thoughts.
On another note: If someone knows how to easily read a single key from
the console instead of relying on the user to hit enter,...
| |
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 multiple Catch
statements, or do I have to figure out how to embed Try Catch statements
into my code. The scenario is this (and I'll paste the actual code at the
bottom of this post). I'm modifying a web browser, and in the About Help
box, it...
|
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 file.exists(myFile)
return 1 'file downloaded
else
return 0 'file not downloaded
|
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 program logic moves to
the classes/methods that execute the batch (instead of s normal, GUI
driven program execution).
Should an error occur somewhere during the batch, I really need to
catch it, so that I can return my main method with an...
|
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 Automatic Updates facility built into the OS or whether accessing the MS Update site directly.
Reason :
The problem is often associated with DLL files not being correctly set up for some reason. Most of the suggested fixes involve registering a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |