(I) the definition of
(Ii) the role of command and run operations
Role: information inquiry system or network is good or bad judgment
Operation: CMD command: Start -> Run -> type cmd or command (in the command line you can see the system version, file system version)
(Iii) basic commands
1) Windows, there are two commands: internal commands and external commands. I.e., internal commands in the command line interpreter built-in commands, no additional procedures, such as dir, copy and the like. External command in the form of an executable file (usually exe extension or com) exists on disk, which means that the program must exist, otherwise Windows can not find the command, such as format.com.
2) after each command to be input Enter, side running, and to obtain the results. Command line interpreter between the string prompt ">" and Enter regarded as one command. If this string is indeed consistent with the Windows command syntax to execute it, it went back after the implementation of prompt or the command line interpreter gives an error message.
3) To learn a command, the best way is to read the command-line help. You can enter "command name /?" Or "help command name" to view online help commands, such as "format /?".
Note: Back up to the time on a return path to the root, as in D: can not back up the \ path.
Another: You can enter a part of when you enter the folder name, press the Tab key completion
(Iv) directory operations command
1. md (Make Directory): Create a directory.
MKDIR [drive:]path
MD [drive:]path
★ If necessary, MKDIR creates any intermediate directories in the path.
For example: Suppose \ a does not exist, then: mkdir \ a \ b and:
mkdir \ A
the chdir \ A
mkdir \ B
the same. If the extension is deactivated, the need to type mkdir \ a \ b \ c \ d.
RD [/S] [/Q] [drive:]path
2) / Q Quiet mode without confirmation belt / S remove a directory tree.
Description:
⑴ only empty subdirectories (excluding files) can be deleted (unless you use the / S parameter).
⑵ root directory of the current directory and can not be deleted.
3. cd (Change Directory): Displays the current directory or changes the current directory.
CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]
1) Type CD drive: to display the current directory of the specified drive. Without parameters only type CD, the current drive and directory is displayed.
2) Use / D switch, in addition to changing the current directory to drive, you can also change the current drive.
(V) file manipulation commands
1. Create a new file
1)cd . > a.txt
">" Indicates that the command output is written to the file, followed by a.txt, it means write to a.txt.
And in this case there will be no command output, so we created an empty file.
2)copy nul a.txt
nul表示空设备,从概念上讲,它不可见,存在于每个目录中,可以把它看成一个特殊的“文件”,它没有内容。
此例子表示将空设备复制到a.txt,同样创建了没有内容的空文件。
2. del :删除一个或数个文件。
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
- names:指定一个或多个文件或者目录列表。通配符可用来删除多个文件。如果指定了一个目录,该目录中的所有文件都会被删除。
- /P 删除每一个文件之前提示确认。
- /F 强制删除只读文件。
- /S 删除所有子目录中的指定的文件。
- /Q 安静模式。删除全局通配符时,不要求确认
- /A 根据属性选择要删除的文件
属性:R 只读文件、S 系统文件、H 隐藏文件、A 存档文件、I 无内容索引文件、L 重分析点、- 表示“否”的前缀
3. 查看文件
1) dir :显示目录中的文件和子目录列表。
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
- [drive:][path][filename] 指定要列出的驱动器、目录和/或文件。
- /A:显示具有指定属性的文件。
属性:D 目录、R 只读文件、H 隐藏文件、A 准备存档的文件、S 系统文件、I 无内容索引文件、L 解析点、- 表示“否”的前缀 - /B:使用空格式(没有标题信息或摘要)。
- /C:在文件大小中显示千位数分隔符。这是默认值。用 /-C 来禁用分隔符显示。
- /D:跟宽式相同,但文件是按栏分类列出的。
- /L:用小写。
- /N:新的长列表格式,其中文件名在最右边。
- /O:用分类顺序列出文件。
排列顺序:N 按名称(字母顺序)、S 按大小(从小到大)、E 按扩展名(字母顺序)、D 按日期/时间(从先到后)、G 组目录优先、- 反转顺序的前缀 - /P:在每个信息屏幕后暂停。
- /Q:显示文件所有者。
- /R:显示文件的备用数据流。
- /S:显示指定目录和所有子目录中的文件。
- /T:控制显示或用来分类的时间字符域。
时间段:C 创建时间、A 上次访问时间、W 上次写入的时间 - /W:用宽列表格式,简要显示。
- /X:显示为非 8.3 文件名产生的短名称。格式是 /N 的格式,短名称插在长名称前面。如果没有短名称,在其位置则显示空白。
- /4:用四位数字显示年
(2) type:显示文本文件的内容。
TYPE [drive:][path]filename
4. 修改文件
(1) ren:重命名文件。
REN [drive:][path]filename1 filename2.
请注意,您不能为目标文件指定新的驱动器或路径。
(2) copy:将一份或多份文件复制到另一个位置
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
- source:指定要复制的文件。
- /A:表示一个 ASCII 文本文件。
- /B:表示一个二进位文件。
- /D:允许解密要创建的目标文件
- destination 为新文件指定目录和/或文件名。
- /V:验证新文件写入是否正确。
- /N:复制带有非 8dot3 名称的文件时,尽可能使用短文件名。
- /Y:不使用确认是否要覆盖现有目标文件的提示。
- /-Y:使用确认是否要覆盖现有目标文件的提示。
- /Z:用可重新启动模式复制已联网的文件。
- /L:如果源是符号链接,请将链接复制到目标而不是源链接指向的实际文件。
要附加文件,请为目标指定一个文件,为源文件指定数个文件(用通配符或 file1+file2+file3 格式)。
? 匹配任意单个字符
[] 匹配括号中的1个字符
[!] 匹配不在括号中的一个字符, 例如: [!1-9]*
另外,通配符在 Windows 的“搜索”中也可以使用。
㈦命令输入技巧
在 DOS 操作系统中,打错命令有两种情况:
1)打错命令,若未回车可用退格键或左方向键(←)抹去错误后重打,然后回车执行。
2)打错了命令,已经回车,可用功能键修改。
常用 DOS 功能键有:
cd [/d] [drive:][directory]
del 删除命令行上指定的文件。可以指定一个或多个文件,可以使用通配符。
如果列出了一个目录,该目录中的所有文件都会被删除,尽管该目录不会删除(要删除目录,使用rd命令)
md foldername 创建一个新目录(同 mkdir)
rd [/s] [/q] path 删除目录
rd path 删除空目录
rd /s path 删除目录
rd /s /q path 删除目录,不提示
copy mydata.dat mydata.backup 将文件移动位置,可以在不同目录
copy mydata.dat e:\files\april2002data.dat
date /t 当前日期
time /t 当前时间
type [path]filename 将指定的文件写到标准输出
ver 显示计算机的Windows版本
dir %windir% /p 分页长列表
dir /w 按行列出名称
dir /d 按列列出名称
dir /ah 列出隐藏文件
start "" "path" 启动带有空格的文件