简体   繁体   中英

Starting exe with Process.Start(), weird stuff going on

Im currently trying to automate the Microsoft Assessment and Planning Toolkit. But I'm running into a problem.

When I start the toolkit by clicking the icon on my desktop, the toolkit works fine. But, if I execute the exe by using Process.Start(), the toolkit bugs. (After a change of the selection in the left pane, the options are not shown. Next to this, when the toolkit is closed an error is shown)

Started from shortcut on my desktop:

从桌面上的快捷方式开始

Started with Process.Start():

从Process.Start()开始

The code for starting the exe:

ProcessStartInfo start = new ProcessStartInfo();
start.FileName = "C:\\Program Files\\Microsoft Assessment and Planning Toolkit\\bin\\MapToolkit.exe";
Process p = Process.Start(start);

Anyone has any idea what this could be, or how I could solve this behaviour?

Try using WorkingDirectory :

ProcessStartInfo start = new ProcessStartInfo();
start.FileName = "C:\\Program Files\\Microsoft Assessment and Planning Toolkit\\bin\\MapToolkit.exe";
start.WorkingDirectory = "C:\\Program Files\\Microsoft Assessment and Planning Toolkit\\bin";
Process p = Process.Start(start);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM