开发者

Help syntax for a dos command

I'm looking for a reference regarding the syntax of 开发者_StackOverflow中文版the help displayed for a dos command.

I didn't find anything with Google.

I need this because I'm writing a batch and I want to provide help for this batch regarding arguments and options.

I know I could deduce it from the help of existing dos commands, but it would be great if there was a full reference about it.


You mean the syntax as in the following?

findstr [/b] [/e] [/l] [/r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/p] [/offline] [/g:file] [/f:file] [/c:string] [/d:dirlist] [/a:ColorAttribute] [strings] [[Drive:][Path] FileName [...]]

That's easy. Things in square brackets can be omitted. The [...] at the end indicates that you can supply more files if you wish, it doesn't have to be just one.

There are also alternatives sometimes:

attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[Drive:][Path] FileName] [/s[/d]]

indicated by curly braces while alternatives are separated by |. Also noteworthy here: /d at the end is only valid if you also provided /s since there are two nested levels of brackets.

There is no strict syntax definition and you can usually figure out some other aspects, like the [...] on your own. Many examples need a bit interpretation (which mostly is obvious, though). E.g. date:

date [mm-dd-yy] [/t]

You can supply a date in a weird format as the first argument, but that's very easy to guess. And no, it doesn't tell you to supply literally mm-dd-yy, but that's why humans read that description, not machines.


EDIT: I just noticed that Technet even gives a summary of the syntax at the bottom of each article:

Help syntax for a dos command

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜