简体   繁体   English

使用Process.Start()启动exe,发生了奇怪的事情

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

Im currently trying to automate the Microsoft Assessment and Planning Toolkit. 我目前正在尝试自动化Microsoft评估和规划工具包。 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. 但是,如果我使用Process.Start()执行exe,则工具包会出错。 (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()开始:

从Process.Start()开始

The code for starting the exe: 启动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 : 尝试使用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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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