(C#新手)使用“额外设置"启动进程吗? [英] (C# newbie) Starting processes with "extra settings"?

查看:54
本文介绍了(C#新手)使用“额外设置"启动进程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!新手在这里查询C#的帮助^^"

因此,我想了解是否有一种方法可以使用C#以最终的特殊设置"(我不知道该怎么称呼)来启动进程.

我的意思是,如果在WarCraft III快捷方式目标的末尾添加"-window",则游戏将在窗口模式下运行.
(因此,如果转到warcraft III快捷方式的属性,则目标将显示"C:\ Games \ Warcraft III \ Warcraft III.exe" -window)

希望您理解我的意思,请问是否不清楚.

最好的问候
-Mossmyr

Hi! Newbie inquiring help in C# here ^^"

So I''d like to learn if there''s a way to start processes with "special settings in the end" (I have no idea what to call it) with C#.

An example of what I mean would be that if you add "-window" at the end of your WarCraft III shortcut target, the game will be run in windowed mode.
(So if you go to properties of the warcraft III shortcut, the target will display ''"C:\Games\Warcraft III\Warcraft III.exe" -window'')

I hope you understand what I mean, please ask if it''s unclear.

Best regards
-Mossmyr

推荐答案

您谈论参数;

System.Diagnostics.Process进程=新的System.Diagnostics.Process();
process.StartInfo.FileName = @"C:\ Games \ Warcraft III \ Warcraft III.exe";
process.StartInfo.Arguments =窗口";
process.UseShellExecute = false;
process.Start();
You talk about parameters;

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = @"C:\Games\Warcraft III\Warcraft III.exe";
process.StartInfo.Arguments = "window";
process.UseShellExecute = false;
process.Start();


是-是参数或程序参数:
Yes - it''s the parameters, or program arguments:
Process.Start(@"C:\Games\Warcraft III\Warcraft III.exe","-window");


这些设置称为命令行参数.您可以使用 Environment.GetCommandLineArgs(); [ ^ ]
These settings are called command line arguments. You can get these arguments using Environment.GetCommandLineArgs();[^]


这篇关于(C#新手)使用“额外设置"启动进程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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