简体   繁体   English

C#System.Diagnostics.Process.Start()参数

[英]C# System.Diagnostics.Process.Start() parameters

Anyone know where a computer keeps what parameters it can accept through this function? 有人知道计算机在哪里保留可以通过此功能接受的参数吗? For example, I'd like to know what I can send to Winword.exe (Microsoft Word). 例如,我想知道可以发送给Winword.exe(Microsoft Word)的内容。 Or is there an online list of what programs work here? 还是这里有什么程序的在线列表?

There's no standard means to query available command line parameters in executables. 没有标准的方法来查询可执行文件中的可用命令行参数。 That's why you have to look online for published lists. 这就是为什么您必须在线查找已发布列表的原因。 For example Microsoft Word . 例如Microsoft Word

The Process.Start(..) overloaded methods pass various data into the process but cannot extract it because of the proprietary nature how a Process uses this info. 重载的Process.Start(..)方法将各种数据传递到流程中,但由于流程如何使用此信息的专有性质,无法将其提取。

If you started the processes then Process.StartInfo may provide some useful information about how it was started (but does not reflect possibilities), and won't work as intended if you're just grabbing a process from memory that you didn't start. 如果启动了进程,则Process.StartInfo可能会提供一些有关启动方式的有用信息(但不反映可能性),如果您只是从未启动的内存中获取进程,则该进程将无法按预期工作。

Although it's customary for many Windows processes to allow /? 尽管许多Windows进程习惯允许/? to produce a list of parameters, and many systems use -help, /help or --help, etc, the output of even those may differ and be tough to consistently parse for discovery purposes. 要生成参数列表,并且许多系统使用-help,/ help或--help等,即使这些参数的输出也可能不同,并且很难为发现目的一致地解析。

这是winword.exe Args list可接受参数的列表

The command line arguments that an application accepts isn't stored anywhere on your hard drive, unless if there's specific documentation that came along with that product. 应用程序接受的命令行参数不会存储在硬盘上的任何位置,除非该产品随附了特定的文档。 That being said, google will be your best friend for this. 话虽如此,谷歌将是您最好的朋友。 Any app you think can be launched from the command line using different parameters, will have some info on the net. 您认为可以使用不同的参数从命令行启动的任何应用程序,都会在网络上提供一些信息。

you can either go to your application's help and find it there, or you can ask good old mr. 您可以在应用程序的帮助下找到它,也可以向老先生询问。 Google to help you. Google可以帮助您。 if you are looking for Windows Word's args list, you can search for it on the support page of Microsoft. 如果要查找Windows Word的args列表,可以在Microsoft的支持页面上进行搜索。 I believe there might be some changes from version to version. 我相信版本之间可能会有一些变化。

Unix has a built-in documentation system for this: man pages. Unix为此提供了一个内置的文档系统:手册页。 This is just one feature of Unix based OSs that shows how programmer-oriented it is (not a bad thing). 这只是基于Unix的操作系统的一项功能,它显示了它是如何面向程序员的(不是一件坏事)。 Another would be the profileration of packaging and dependency systems. 另一个将是包装和依赖系统的概要分析。

Alas, no such standard exists for Windows. ,, Windows没有这样的标准。

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

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