473,804 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process invoking an executable

Hi all,

First I would like to say that I'm thrilled to be a part of this great
news group!

I'm kinda new to c#, yet I have a tight schedule to deliver my project
(ain't it always like that :) and I have a question regarding a
process invoking another executable.

If you could just point out some keywords which I can google up it can
be really great.
I was given an executable file a.exe which I need to invoke using my
console application.
I googled up and found System.Diagnost ics.Process.Sta rt().
How can I get the exit code of a.exe?
Is there a better way than System.Diagnost ics.Process.Sta rt?
Is there a way to run a.exe in-process (currently my process ends
while a.exe still goes on)?
What is the best way to do so if my process and a.exe are not on the
same machine?
If I could re-write a.exe and implement object model in it (in c++ I
would use COM) what should I use in c#?

Thank you very much for your help!
Orsula.

Aug 6 '08 #1
2 1631
orsula <or******@gmail .comwrote:
If you could just point out some keywords which I can google up it can
be really great.
I was given an executable file a.exe which I need to invoke using my
console application.
I googled up and found System.Diagnost ics.Process.Sta rt().
How can I get the exit code of a.exe?
Process.ExitCod e.
Is there a better way than System.Diagnost ics.Process.Sta rt?
Not really.
Is there a way to run a.exe in-process (currently my process ends
while a.exe still goes on)?
You can call Process.WaitFor Exit. You can't run one process inside
another though.
What is the best way to do so if my process and a.exe are not on the
same machine?
Well, you could *try* just running it, but I'm not sure I'd expect it
to work.
If I could re-write a.exe and implement object model in it (in c++ I
would use COM) what should I use in c#?
I'm not entirely sure what you're getting at here.

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Aug 6 '08 #2
On Aug 7, 12:27*am, Jon Skeet [C# MVP] <sk...@pobox.co mwrote:
orsula <orsul...@gmail .comwrote:
If you could just point out some keywords which I can google up it can
be really great.
I was given an executable file a.exe which I need to invoke using my
console application.
I googled up and found System.Diagnost ics.Process.Sta rt().
How can I get the exit code of a.exe?

Process.ExitCod e.
Is there a better way than System.Diagnost ics.Process.Sta rt?

Not really.
Is there a way to run a.exe in-process (currently my process ends
while a.exe still goes on)?

You can call Process.WaitFor Exit. You can't run one process inside
another though.
What is the best way to do so if my process and a.exe are not on the
same machine?

Well, you could *try* just running it, but I'm not sure I'd expect it
to work.
If I could re-write a.exe and implement object model in it (in c++ I
would use COM) what should I use in c#?

I'm not entirely sure what you're getting at here.

--
Jon Skeet - <sk...@pobox.co m>
Web site:http://www.pobox.com/~skeet*
Blog:http://www.msmvps.com/jon.skeet
C# in Depth:http://csharpindepth.com


Thanks a lot for your help Jon :)
Aug 7 '08 #3

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

Similar topics

10
2167
by: Steve | last post by:
I need help. I'm trying to write a process wrapper class in Python (on Linux) that let's one: - read service definitions from a config file (where a service definition includes a bash command to start the service, and the service is a daemon) - call a method that will start up the service - call a method that will shut down the service. - other stuff not relevant here Where I'm stumped is in starting up the service in a way that: -...
0
1238
by: belgi | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while
5
2604
by: Simon Harvey | last post by:
Hi, I have a simple .exe application that I need to invoke from my C# application. I need to send it two strings and then get the result back. Can anyone advise me on how this is done? Also, I'm currently using a windows forms application but I would like to use an ASP.net appliocation to invoke the .exe file in the future. Is this possible and will it cause any complications?
3
5145
by: belgiozen | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while the executable(MYPROGRAM.EXE) is running,it will wait for a time(about 20 seconds) for the main windows thread to abort.If it does not finish its work, the...
10
14427
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another user to gain the required rights for execution (the external process needs to create a mailbox in Exchange, so it needs to be run as an Exchange Full Administrator-powered user). For the moment, I have tries using the Start() static method of the...
3
22499
by: James Li | last post by:
I have the code below, the first process takes about 10 minutes to finish. But the waitForExit doesn't seem to wait when I debug the program, it go immediately to execute code after the WaitForExit(). The first process basically launch a DOS batch file to do some task, am I missing anything? executable = "setup_listener.bat"; process1 = new Process(); process1.StartInfo.UseShellExecute = false; process1.StartInfo.CreateNoWindow =...
4
32806
by: Andy | last post by:
I am calling out to an executable using the System.Diagnostics.Process methods and specifically attempting to trap for errors (at least trying to learn how to trap for errors). I arranged the data to specifically error when calling this executable. System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = "intupld.exe"; process.StartInfo.Arguments = hupFile; process.StartInfo.WorkingDirectory =...
8
3229
by: Lonifasiko | last post by:
Hi, Using Process class I asynchronously launch an executable (black box executable) file from my Windows application. I mean asynchronously because I've got an EventHandler for "Exited" event. Therefore, when process finishes, "Exited" event is raised. This executable writes a long file for over 1-5 minutes, and I, from my application must read that file while is being generated.
4
2877
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a web page hosted on a unix driven file server. The user wants to have this file converted to a pdf. My page takes the query string and turns it into a windows unc path, then I copy the file down to the web server and place it into a directory. This...
0
9704
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
10318
jinu1996
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...
0
9130
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
6844
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
5503
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...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
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.