0

I need to mimic the command line version of this:

If i am in say H:\

And run:

H:\> D:\MyFolder\MyOtherFolder\TheFile.exe

This will launch TheFile.exe app, though that needs to run as if it was launched from:

D:\MyFolder\MyOtherFolder\> TheFile.exe

Anyway to get Process.Launch to execute from actual folder not the app folder thats running the code that launches the .exe?

Codejoy
  • 3,722
  • 13
  • 59
  • 99

1 Answers1

3

You can specify the working directory in Process start. For example:

   AppProcess = new Process();

   AppProcess.StartInfo.FileName = "D:\\MyFolder\\MyOtherFolder\\TheFile.exe";
   AppProcess.StartInfo.WorkingDirectory = "D:\\MyFolder\\MyOtherFolder";
   AppProcess.Start();
PepitoSh
  • 1,774
  • 14
  • 13