473,626 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Code to Call an exe - then get the status back?

Hi all,

I need to make a scheduling service that will call an exe file.

As I understand it, the exe can return a status code from its Main method.

My question is, how do I programmaticall y:

a. Call the exe

b. Get the status code returned from the exe

I anyone could point me in the right direction I would be very grateful

Kindest Regards

Simon
Jun 30 '06 #1
1 1249
See below - hope this helps. Note that more advanced options are available
via the Process and ProcessStartInf o classes - e.g. to control window
visibility, streaming IO, etc

Marc

===

using System;
using System.Diagnost ics;

static class Program {
static void Main() {
using (Process proc = new Process()) {
proc.StartInfo = new ProcessStartInf o("notepad.exe" );
proc.Start();
proc.WaitForExi t();
Console.WriteLi ne(proc.ExitCod e);
}
}
}
Jun 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9497
by: Andy Gayton | last post by:
Hey all, It looks like dynamic changes to a html document are only redrawn when the current code snippet comes to an end. For example the following page changes the text in a span, waits for a bit, and then sets the text in the span to something else when done. You don't see the change though. -----
0
3927
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
4
5073
by: jay | last post by:
I am using the dataset object to add a row to a sql server database in vb.net code, as follows: dim drow as DataRow dim cmdBld as new SqlCommandBuilder(mySqlDataAdapter) ds.tables(0).NewRow() drow("field1") = data for field 1 and so forth ds.tables(0).rows.add(drow) cmdBld = New SqlCommandBuilder(mySqlDataAdapter)
2
5037
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified folder structure and naming conventions and then send a Net send message to those users telling them to rectify. The information I want to get is when you select the file/folder and then: Properties -> Security Tab -> Advanced Button -> Owner Tab ->...
0
1207
by: Al Fatykhov | last post by:
Using MABLE logic engine with existing .NET applications. MABLE web services provide an interface to MABLE business objects and logic. Let us review some technical details of the MABLE web services. · MABLE utilizes SOAP 1.2 protocol. · MABLE uses AXIS 1.4 as a web service transport. · MABLE support state-full conversations by implementing a conversation session.
1
1076
by: Simon Harvey | last post by:
Hi all, I need to make a scheduling service that will call an exe file. As I understand it, the exe can return a status code from its Main method. My question is, how do I programmatically: a. Call the exe
7
6975
by: Serge Rielau | last post by:
Hi all, Following Ian's passionate postings on problems with ALTOBJ and the alter table wizard in the control center I'll try to explain how to use ALTOBJ with this thread. I'm not going to get into the GUI because it is hard to describe in text. First of all what is the purpose of ALTOBJ()? This procedure was created mostly for ISVs who need to do produce change scripts to upgrade application from release to release, but it can also
0
3603
by: rnaimon | last post by:
I found the following information on this site, but I am unable to get it to work. All it brings back is the xml page with no data. I am running a Windows 2003 Server with Exchange 2003 Server. When the code gets to This line.. If objDoc.loadXml(objRequest.ResponseText) Then The results return False and I don't receive any data. Does anyone know what the problem may be? Re: ASP: Exchange 2003 Free/Busy Lookup ...
13
3988
by: Marvin Zhang | last post by:
Hi, I'm not familiar with web programming, but I have a problem here. I have a page. When a user click one button on it, I will use AJAX to request a PHP script which will do a bunch of tasks, asynchronously. These tasks might take long time so I want to keep the user informed of the progress. The problem is that only the PHP script knows the progress, how can the web page gets these information from PHP script?
1
4336
by: spatro | last post by:
Hi, I am trying to install DBD::mysql using the CPAN and I am facing the following error: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Warning: Found only 0 objects in /root/.cpan/Metadata CPAN: LWP::UserAgent loaded ok
0
8265
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, 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...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8364
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,...
0
8504
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 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...
0
7193
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, 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...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1511
bsmnconsultancy
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...

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.