Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
how can I execute an exe file in C#?
Process.Start() wasn't useful!
Posted
Updated 22-Dec-11 3:34am
v2
Comments
Rajesh Anuhya 22-Dec-11 9:06am    
how "Process.Star() " is not useful??
Sergey Alexandrovich Kryukov 14-Mar-13 13:02pm    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership.
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

See the below MSDN example

C#
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        public static void Main()
        {
            Process myProcess = new Process();

            try
            {
                myProcess.StartInfo.UseShellExecute = false;
                // You can start any process, HelloWorld is a do-nothing example.
                myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
                myProcess.StartInfo.CreateNoWindow = true;
                myProcess.Start();
                // This code assumes the process you are starting will terminate itself.
                // Given that is is started without a window so you cannot terminate it
                // on the desktop, it must terminate itself or you can do it programmatically
                // from this application using the Kill method.
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
 
Share this answer
 
Comments
RaviRanjanKr 22-Dec-11 17:32pm    
5+
What do you mean "it wasn't useful"?? Any error-message? Describe your problem. Help others to help you, don't just state "it wasn't useful" or "it didn't work"!

Anyway, have a look here[^]

It's Process.Start() by the way, not Process.Star() (mentioning that just in case...).
 
Share this answer
 
Comments
Member 8459783 22-Dec-11 9:25am    
no error message...nothing happen!(sry; Process.Start())
First of all, please see my comment to the question. Please comply.

You are right, in a way: Process.Start is not very useful, because in most cases, developing application starting some other process is a pretty bad idea, because processes are well isolated, so your ability to collaborate with those processes are extremely limiting. However, this very rough rule of thumb has many exclusions, when you actually need to start some application.

And for this purpose, Process.Start is not only useful, it's the only way to go. And achieving this goal is so hard to screw up that only people who notoriously screw up nearly everything can fail. I'm sure you are not one of them, so I cannot understand the reason of your statement.

Good luck,
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900