在'EXE'项目中设置'启动命令参数' [英] Setting 'startup command arguments' in 'EXE' project
问题描述
我们需要通过启动Visual Studio 2015并将exe作为项目打开来实现自动化:
we need to automation Visual Studio 2015 by launching it and opening an exe as project:
dte .ExecuteCommand(" File.OpenProject",@" MyExecutable.exe");
dte.ExecuteCommand("File.OpenProject", @"MyExecutable.exe");
但是我们还需要添加一些启动参数,这似乎有些问题,因为project似乎不是VCproject,也不是.NET项目(动态转换不起作用)。有没有人知道如何输入启动参数?
However we also need to add some startup arguments and this seems to be somewhat of an issue since the project doesn't appear to be a VCproject, nor a .NET project (dynamic casting doesn't work). Does anyone have an idea on how to enter the startup arguments?
提前致谢。
问候。
Yves
推荐答案
Hi Puelings,
Hi Puelings,
我们可以使用System.Diagnostics.Process方法有了实现它的论据。像这样:
We could use System.Diagnostics.Process method with arguments to achieve it. like this:
ProcessStartInfo startInfo = new ProcessStartInfo("MyExecutable.exe");
startInfo.WindowStyle = ProcessWindowStyle.Normal;
// Start with one argument.
// Output of ArgsEcho:
// [0]=/a
startInfo.Arguments = "/a";
System.Diagnostics.Process.Start(startInfo);
有关详细信息,请参阅:
For more information, please refer to:
祝你好运,
Cole Wu
这篇关于在'EXE'项目中设置'启动命令参数'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!