在'EXE'项目中设置'启动命令参数' [英] Setting 'startup command arguments' in 'EXE' project

查看:1039
本文介绍了在'EXE'项目中设置'启动命令参数'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我们需要通过启动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:

HTTPS:// MSDN。 microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1

祝你好运,

Cole Wu


这篇关于在'EXE'项目中设置'启动命令参数'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆