skip to Main Content

How I can launch exe file with c# code?
So I have this :

Process.Start( @"C:Program Files (x86)PhotoshopPhotoshop.exe");

But the path can be different in other machines. So is there any ideas to run .exe with different way?

Thanks!

3

Answers


  1. Chosen as BEST ANSWER

    I found a solution.

    Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));
    

  2. No, you cannot run an exe file without knowing its location.

    The “exception” is if the executable directory is in the PATH environment variable, which is why:

    Process.Start("notepad.exe");
    

    works.

    Login or Signup to reply.
  3. If i understood you correctly , the executable is in your reach, so just put it in the project directory and do not specify any path (the default is a relative path):

    Process.Start("Photoshop.exe");
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search