How to start a process in the same folder as its executable

后端 未结 3 847
天命终不由人
天命终不由人 2021-01-11 17:09

I\'m trying to start an application programatically, but it always runs it in the folder of my application... For example:

If my app is located in C:\\MyApp\\myapp

3条回答
  •  一整个雨季
    2021-01-11 17:33

    Just set the WorkDirectory property.

    process.StartInfo.WorkingDirectory = Path.GetDirectoryName(application.Filename);
    

提交回复
热议问题