正在搜索命令提示符参数?

时间:2015-01-26 21:34:42

标签: windows cmd

无论如何都要搜索一般意义上的命令提示符参数。或者我们是否受制于此类计划的文件?例如,在命令提示符中我键入explorer或notepad ...但是如果我将第一个参数作为文件路径,它将为我打开该文件路径...我怎么知道这个参数输入存在并且可能有我不知道的一堆其他参数字段。有没有系统地搜索程序参数?

2 个答案:

答案 0 :(得分:1)

没有。虽然您可以随时尝试programname /?

记事本仅采用​​单个文件名或采用/p filename ...(您可以在注册表中的txtfiles打印条目中查看命令)。

这是来自Windows 98资源管理器的东西,它仍然是相同的。

Explorer 
explorer [/n] [/e][,/root,object][[,/select],subobject]

None Explorer rooted at the Desktop 
/n Opens a new window. 
/e Explorer View (default if nothing else is on the command line.) 
/root,object Starts Explorer with object the top item (normally Desktop is the top item). Eg: explorer /e,/root,c:\Starts Explorer with the C drive as the only drive available. 
/select,subobject Selects the specified subobject. 

Replaceable parameters are %1 (one) which is the short file or folder name and %l (L) which is the long file name.

/IDLIST
This is an additional parameter that means a Windows internal structure is being passed. eg:

Explorer.exe /e,/idlist,%I
The %I is a replacable parameter representing an IDLIST.

Rooted Views
To open an explorer item that starts with a special folder as the top folder use the following syntax.

Where the special folder is a sub folder of the desktop

explorer /e,root,::{CLSID of special folder}

Where the special folder is a sub folder of another special folder (usually, if not always My Computer) 

explorer /e,root,::{CLSID of parent}/::{CLSID of special folder}

Where the special folder is part of the file system

explorer /e,root,path to folder

See Namespaces on the Icons Page for a list of CLSIDs for special folders.

Examples
Note that /select is inconsistent. Sometime the / is required, sometimes it should be left out, and sometimes it doesn't matter.

Starts explorer with the Windows folder opened and selected.

explorer /e,select,c:\windows
Starts explorer with Windows the top level folder and command opened and selected.

explorer /e,/root,c:\windows,select,c:\windows\command
Starts explorer with Windows the top level folder and Tips.txt showing instead of the file listing.

explorer /e,/root,c:\windows,select,c:\windows\tips.txt
Starts explorer with My Computer the top level folder and all branches except for drives collapsed. 

explorer /e,/root,::{20d04fe0-3aea-1069-a2d8-08002b30309d}
Starts explorer with C:\ the top level folder. 

explorer /e,/root,c:\
Starts the Dial Up Networking folder in folder view.

explorer.exe ::{20d04fe0-3aea-1069-a2d8-08002b30309d}\::{992cffa0-f557-101a-88ec-00dd010ccc48}

答案 1 :(得分:1)

在Windows程序中负责处理自己的命令行参数,他们可以以任何方式进行处理。 (通常将标记化移交给C运行时库,但不是强制性的。)

这为程序员提供了最大的灵活性,但这意味着如果程序员没有记录命令行,那么事后就没有直接的方法来对其进行逆向工程。

(UNIX差别不大;标记化由shell处理,但其余的处理是应用程序的责任。相比之下,在VMS中,整个命令行处理由shell处理,基于关于必须嵌入应用程序的语法信息。)

应用程序通常会提供命令行语法摘要以响应以下一个或多个选项:

application /?
application -?
application /help
application -help
application --?
application --help

(大致从最常见到最不常见的排列;带有两个连字符的变体通常只能在从UNIX移植过的软件中找到。)

我没有查找实际的统计数据,但我的印象是大多数命令行应用程序(可能是80%或更多)确实提供了这样的摘要。 GUI应用程序不太常见。

如果失败,您有时可以通过查找可执行文件中的字符串来查找命令行选项。 Microsoft提供了一个实用程序,strings.exe可以从他们的网站下载。 (当然,知道存在可能的命令行选项并不一定意味着你将能够弄清楚它的作用!)

如果您有权访问源代码,或者熟练进行反汇编,那么如果您非常绝望,这可能会提供另一种选择。

相关问题