473,395 Members | 1,678 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,395 software developers and data experts.

running .exe file from my program

Hello,

I am working on a C#.NET project that needs to call .exe file from a project that I previously worked on. So, basically project A, needs to call project B. I am not sure how to do it. I tried calling with Process.Start ("something.exe"), but nothing happens so I am thinking maybe I have to be more specific to where exactly something.exe is located. Does something.exe has to be inside the same folder as project A? When I look for something.exe of my project B, I have two folders obj & bin, inside which of these is the .exe file that program A needs to run? I hope this is not too confusing....

This is really urgent and any help would be highly appreciated!

Thanks!

P.S. When project A tries to run exe file of my project B using Process.Start I get the error saying the project encountered a problem and needs to close down. I think the issue is with the location of my exe file.
Oct 31 '09 #1
2 4113
Saser
17
Try this:

Expand|Select|Wrap|Line Numbers
  1. using System.Diagnostics;
  2.  
  3. ...
  4.  
  5. Process someProcess = new Process();
  6. someProcess.StartInfo.FileName = @"<complete path to executable file here>";
  7. someProcess.StartInfo.Arguments = ""; // If you want to pass some arguments to the file being executed
  8. someProcess.Start();
Be sure to include the @ in FileName, because otherwise you'd need to use double backslashes in the path. Not really necessary, but it's for convenience.
Nov 1 '09 #2
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.ProcessStartInfo info = new ProcessStartInfo(filePath,fileName );
  2.       Process pdfCreationProcess = new Process();
  3.       pdfCreationProcess.StartInfo = info;
  4.       pdfCreationProcess.Start();
  5.       pdfCreationProcess.WaitForExit();
  6.       pdfCreationProcess.Exited += new EventHandler(fileCreationProcess_Exited);
  7.       pdfCreationProcess.EnableRaisingEvents = true;
  8.       pdfCreationProcess.Close();
Use fileCreationProcess_Exited event to run the code which needed to be run after exiting the targeted exe
Nov 2 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Fabio Pliger | last post by:
Hi, is it possibile, in python, to check for an already running instance of an application? My problem is that, if my program i running and the user relaunch it, i don't want to open a new...
17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
6
by: Pierre-Yves | last post by:
Hello, I would like to prevent my perl program to be executed several times simultaneously (if the program is already running, I would like to display a message like "another instance of this...
1
by: Mike S. Nowostawsky | last post by:
I am getting this error when I try to run a program in my cgi-bin directory (don't know what I'm still missing to make it work): *** Authentication required! This server could not verify that...
4
by: Nick Sinclair | last post by:
Hi all, I'm new to C. I have successfully written a small C program that acts as a "wrapper" around cgi scripts. These scripts perform admin tasks such as backing up etc. Obviously, The need...
9
by: Michael.Suarez | last post by:
Suppose I have a program that prompts you with a dialogbox to enter a password. If you get the password correct, it allows you into the program, else it kills the program. Suppose that when I...
10
by: jon | last post by:
I am a beginner C programmer, this is actually my first programming lanugage, besides html, cgi, and javascript. I am looking for a way to make an .exe file, or a copy of my own file. I have tried...
8
by: Shooter4Life8 | last post by:
I am trying to run a macro from my VB.NET program. Here is my code. Dim myAccess As Access.Application Dim allMacro As String = "ALL-Macros" myAccess.DoCmd.RunMacro(allMacro) I get the error....
0
by: jfigueiras | last post by:
>I have a problem with the module subprocess! As many other programs... I'm not sure what you mean by "non-standard file descriptors". The other program is free to open, read, write, etc any...
4
lifeisgreat20009
by: lifeisgreat20009 | last post by:
This is what i am getting on running the program......... C:\PROGRA~1\Java\JDK15~1.0\bin>javac Editor.java Note: Editor.java uses or overrides a deprecated API. Note: Recompile with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
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...

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.