说明DOS命令格式的语法

比如说今天遇到一个问题, 想要应用一下net use这条命令, google一下, 发现下面的命令用法的说明:

net use [{DEVICE | *}] [\\COMPUTER\SHARE[\VOL]] [{PASSWORD | *}]] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [{/DELETE | /PERSISTENT:{yes | no}}]

 

net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]

 

net use [/PERSISTENT:{yes | no}]

 

然后会给出一些例子, 一般就看看举出的例子就大致知道了命令应该如何应用. 但是处于积累的目的, 我们还是有必要搞清楚这里的用来说明命令使用的符号都代表什么意思.

 

要点如下:

  • 方括号中的元素是可选的.
  • 三个点说明该元素可以重复任意多次的.
  • 竖线说明被它分隔的元素, 必须选一个.
  • 前倾斜杠(slash)跟随的是一个开关.

 

找到说明这个问题的英文文章如下:

 

Syntax Notes

==================

To be functional, each DOS command must be entered in a particular way. This command entry structure is known as the command's "syntax." The syntax "notation" is a way to reproduce the command syntax in print. Think of syntax as pronouncing the command or language, but in writing.

For example, you can determine the items that are optional, by looking for information that is printed inside square brackets. The notation [d:], for example, indicates an optional drive designation. The command syntax, on the other hand, is how you enter the command to make it work.

 

Command Syntax Elements

------------------------

1. Command Name
The DOS command name is the name you enter to start the DOS program (a few of the DOS commands can be entered using shortcut names). The DOS command name is always entered first. In this book, the command is usually printed in uppercase letters, but you can enter command names as either lowercase or uppercase or a mix of both.


2. Space
Always leave a space after the command name.


3. Drive Designation
The drive designation (abbreviated in this book as "d:") is an option for many DOS commands. However, some commands are not related to disk drives and therefore do not require a drive designation. Whenever you enter a DOS command that deals with disk drives and you are already working in the drive in question, you do not have to enter the drive designator. For example, if you are working in drive A (when the DOS prompt A> is showing at the left side of the screen) and you want to use the DIR command to display a directory listing of that same drive, you do not have to enter the drive designation. If you do not enter a drive designation, DOS always assumes you are referring to the drive you are currently working in (sometimes called the "default" drive).


4. A Colon
When referring to a drive in a DOS command, you must always follow the drive designator with a colon (:) (this is how DOS recognizes it as a drive designation).


5. Pathname
A pathname (path) refers to the path you want DOS to follow in order to act on the DOS command. As described in Chapter 3, it indicates the path from the current directory or subdirectory to the files that are to be acted upon.


6. Filename
A filename is the name of a file stored on disk. As described in Chapter 1, a filename can be of eight or fewer letters or other legal characters.


7. Filename Extension
A filename extension can follow the filename to further identify it. The extension follows a period and can be of three or fewer characters. A filename extension is not required.


8. Switches
Characters shown in a command syntax that are represented by a letter or number and preceded by a forward slash (for example, "/P") are command options (sometimes known as "switches"). Use of these options activate special operations as part of a DOS command's functions.


9. Brackets
Items enclosed in square brackets are optional; in other words, the command will work in its basic form without entering the information contained inside the brackets.


10. Ellipses
Ellipses (...) indicate that an item in a command syntax can be repeated as many times as needed.


11. Vertical Bar
When items are separated by a vertical bar (|), it means that you enter one of the separated items. For example: ON | OFF means that you can enter either ON or OFF, but not both.

 

原文地址: http://www.dewassoc.com/support/msdos/dos_commands.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值