『楼 主』:
DOS命令大全
使用 LLM 解释/回答一下
DOS命令大全
一)MD——建立子目录
1.功能:创建新的子目录
2.类型:内部命令
3.格式:MD〈子目录名〉
4.使用说明:
(1)“盘符”:指定要建立子目录的磁盘驱动器字母,若省略,则为当前驱动器;
(2)“路径名”:要建立的子目录的上级目录名,若缺省则建在当前目录下。
例:(1)在C盘的根目录下创建名为FOX的子目录;(2)在FOX子目录下再创建USER子目录。
C:、>MD FOX (在当前驱动器C盘下创建子目录FOX)
C:、>MD FOX 、USER (在FOX 子目录下再创建USER子目录)
(二)CD——改变当前目录
1.功能:显示当前目录
2.类型:内部命令
3.格式:CD
4.使用说明:
(1)如果省略路径和子目录名则显示当前目录;
(2)如采用“CD、”格式,则退回到根目录;
(3)如采用“CD.。”格式则退回到上一级目录。
例:(1)进入到USER子目录;(2)从USER子目录退回到子目录;(3)返回到根目录。
C:、>CD FOX 、USER(进入FOX子目录下的USER子目录)
C:、FOX、USER>CD.。 (退回上一级根目录)
C:、FOX>CD、 (返回到根目录)
C:、>
(三)RD——删除子目录命令
1.功能:从指定的磁盘删除了目录。
2.类型:内部命令
3.格式:RD
4.使用说明:
(1)子目录在删除前必须是空的,也就是说需要先进入该子目录,使用DEL(删除文件的命令)将其子目录下的文件删空,然后再退回到上一级目录,用RD命令删除该了目录本身;
(2)不能删除根目录和当前目录。
例:要求把C盘FOX子目录下的USER子目录删除,操作如下:
第一步:先将USER子目录下的文件删空;
C、>DEL C:、FOX、USER、*。*
第二步,删除USER子目录。
C、>RD C:、FOX、USER
(四)DIR——显示磁盘目录命令
1.功能:显示磁盘目录的内容。
2.类型:内部命令
3.格式:DIR
4.
使用说明:/P的使用;当欲查看的目录太多,无法在一屏显示完屏幕会一直往上卷,不容易看清,加上/P参数后,屏幕上会分面一次显示23行的文件信息,然后暂停,并提示;Press
any key to continue
/W的使用:加上/W只显示文件名,至于文件大小及建立的日期和时间则都省略。加上参数后,每行可以显示五个文件名。
PATH——路径设置命令
1.功能:设备可执行文件的搜索路径,只对文件有效。
2.类型:内部命令
3.格式:PATH目录{,〈目录路径名2〉…}
4.使用说明:
(1)当运行一个可执行文件时,DOS会先在当前目录中搜索该文件,若找到则运行之;若找不到该文件,则根据PATH命令所设置的路径,顺序逐条地到目录中搜索该文件;
(2)PATH命令中的路径,若有两条以上,各路径之间以一个分号“;”隔开;
(3)PATH命令有三种使用方法:
PATH…(设定可执行文件的搜索路径) PATH:(取消所有路径)
PATH:(显示目前所设的路径)
(六)TREE——显示磁盘目录结构命令
1.功能:显示指定驱动器上所有目录路径和这些目录下的所有文件名。
2.类型:外部命令
3.格式:TREE
4.使用说明:
(1)使用/F参数时显示所有目录及目录下的所有文件,省略时,只显示目录,不显示目录下的文件;
(2)选用>PRN参数时,则把所列目录及目录中的文件名打印输出。
(七)DELTREE——删除整个目录命令
1.功能:将整个目录及其下属子目录和文件删除。
2.类型:外部命令
3.格式:DELTREE〈路径名〉
4.使用说明:该命令可以一步就将目录及其下的所有文件、子目录、更下层的子目录一并删除,而且不管文件的属性为隐藏、系统或只读,只要该文件位于删除的目录之下,DELTREE都一视同仁,照删不误。使用时务必小心!!!
五、磁盘操作类命令
(一)formAT——磁盘格式化命令
1.功能:对磁盘进行格式化,划分磁道和扇区;同时检查出整个磁盘上有无带缺陷的磁道,对坏道加注标记;建立目录区和文件分配表,使磁盘作好接收DOS的准备。
2.类型:外部命令
3.格式:formAT〈盘符:〉
4.使用说明:
(1)命令后的盘符不可缺省,若对硬盘进行格式化,则会如下列提示:WARNING:ALL DATA ON NON
——REMOVABLE DISK
DRIVE C:WILL BE LOST !
Proceed with format (Y/N)?
(警告:所有数据在C盘上,将会丢失,确实要继续格式化吗?)
(2)若是对软盘进行格式化,则会如下提示:Insert mew diskette for drive A;
and press ENTER when ready…
(在A驱中插入新盘,准备好后按回车键)。
(3)选用参数,将把DOS系统文件IO.SYS
、MSDOS.SYS及COMMAND.COM复制到磁盘上,使该磁盘可以做为DOS启动盘。若不选用/S参数,则格式化后的磙盘只能读写信息,而不能做为启动盘;
(4)选用参数,在1.2MB的高密度软驱中格式化360KB的低密度盘;
(5)选用参数,快速格式化,这个参数并不会重新划分磁盘的磁道貌岸然和扇区,只能将磁盘根目录、文件分配表以及引导扇区清成空白,因此,格式化的速度较快。
(6)选用参数,表示无条件格式化,即破坏原来磁盘上所有数据。不加/U,则为安全格式化,这时先建立一个镜象文件保存原来的FAT表和根目录,必要时可用UNFORRMAT恢复原来的数据。
(二)UNformAT恢复格式化命令
1.功能:对进行过格式化误操作丢失数据的磁盘进行恢复。
2.类型:外部命令
3.格式:UNformAT〈盘符〉
4.使用说明:用于将被“非破坏性”格式化的磁盘恢复。根目录下被删除的文件或子目录及磁盘的系统扇区(包括FAT、根目录、BOOT扇区及硬盘分区表)受损时,也可以用UNformAT来抢救。
(1)选用/L参数列出找到的子目录名称、文件名称、大孝日期等信息,但不会真的做formAT工作。
(2)选用/P参数将显示于屏幕的报告(包含/L参数所产生的信息)同时也送到打印机。运行时屏幕会显示:“Print out will
be sent to LPT1”
(3)选用/TEST参数只做模拟试验(TEST)不做真正的写入动作。使用此参数屏幕会显示:“Simulation only”
(4)选用/U参数不使用MIRROR映像文件的数据,直接根据磁盘现状进行UNformAT。
(5)选用/PSRTN;修复硬盘分区表。
若在盘符之后加上/P、/L、/TEST之一,都相当于使用了/U参数,UNformAT会“假设”此时磁盘没有MIRROR映像文件。
注意:UNformAT对于刚formAT的磁盘,可以完全恢复,但formAT后若做了其它数据的写入,则UNformAT就不能完整的救回数据了。UNformAT并非是万能的,由于使用UNformAT会重建FAT与根目录,所以它也具有较高的危险性,操作不当可能会扩大损失,如果仅误删了几个文件或子目录,只需要利用UNDELETE就够了。
三) CHKDSK——检查磁盘当前状态命令
1.功能:显示磁盘状态、内存状态和指定路径下指定文件的不连续数目。
2.类型:外部命令
3.格式:CHKDSK
4.使用说明:
(1)选用参数,则显示该文件占用磁盘的情况;
(2)选参数,纠正在指定磁盘上发现的逻辑错误;
(3)选用参数,显示盘上的所有文件和路径。
(四)DISKCOPY——整盘复制命令
1.功能:复制格式和内容完全相同的软盘。
2.类型:外部命令
3.格式:DISKCOPY
4.使用说明:
(1)如果目标软盘没有格式化,则复制时系统自动选进行格式化。
(2)如果目标软盘上原有文件,则复制后将全部丢失。
(3)如果是单驱动器复制,系统会提示适时更换源盘和目标盘,请操作时注意分清源盘和目标盘。
(五)LABEL——建立磁盘卷标命令
1.功能:建立、更改、删除磁盘卷标。
2.类型:外部命令
3.格式:LABEL
4.使用说明:
(1)卷标名为要建立的卷标名,若缺省此参数,则系统提示键入卷标名或询问是否删除原有的卷标名;
(2)卷标名由1至11个字符组成。
(六)VOL——显示磁盘卷标命令
1.功能:查看磁盘卷标号。
2.类型:内部命令
3.格式:VOL
4.使用说明:省略盘符,显示当前驱动器卷标。
(七)SCANDISK——检测、修复磁盘命令
1.功能:检测磁盘的FAT表、目录结构、文件系统等是否有问题,并可将检测出的问题加以修复。
2.类型:外部命令
3.格式:SCANDISK{…}
4.使用说明:
(1)CCANDISK适用于硬盘和软盘,可以一次指定多个磁盘或选用参数指定所有的磁盘;
(2)可自动检测出磁盘中所发生的交叉连接、丢失簇和目录结构等逻辑上的错误,并加以修复。
(八)DEFRAG——重整磁盘命令
1.。功能:整理磁盘,消除磁盘碎块。
2.类型:外部命令
3.格式:DEFRAG
4.使用说明:选用/F参数,将文件中存在盘上的碎片消除,并调整磁盘文件的安排,确保文件之间毫无空隙。从而加快读盘速度和节省磁盘空间。
(九)SYS——系统复制命令
1.功能:将当前驱动器上的DOS系统文件IO.SYS,MSDOS.SYS和COMMAND.COM 传送到指定的驱动器上。
2.类型:外部命令
3.格式:SYS
*使用说明:如果磁盘剩余空间不足以存放系统文件,则提示:No roomfor on destination disk.
文件操作类命令
(一) COPY文件复制命令
1.功能:拷贝一个或多个文件到指定盘上。
2.类型:内部命令
3.格式:COPY 〈源文件名〉
4.使用说明:
(1)COPY是文件对文件的方式复制数据,复制前目标盘必须已经格式化;
(2)复制过程中,目标盘上相同文件名称的旧文件会被源文件取代;
(3)复制文件时,必须先确定目标般有足够的空间,否则会出现;insufficient的错误信息,提示磁盘空间不够;
(4)文件名中允许使用通配举“*”“?”,可同时复制多个文件;
(5)COPY命令中源文件名必须指出,不可以省略。
(6)复制时,目标文件名可以与源文件名相同,称作“同名拷贝”此时目标文件名可以省略;
(7)复制时,目标文件名也可以与源文件名不相同,称作“异名拷贝”,此时,目标文件名不能省略;
(8)复制时,还可以将几个文件合并为一个文件,称为“合并拷贝”,格式如下:COPY;〈源文件名1〉〈源文件名2〉…〈目标文件名〉;
(9)利用COPY命令,还可以从键盘上输入数据建立文件,格式如下:COPY CON 〈文件名〉;
(10)注意:COPY命令的使用格式,源文件名与目标文件名之间必须有空格!
(二)XCOPY——目录复制命令
1.功能:复制指定的目录和目录下的所有文件连同目录结构。
2.类型:外部命令
3.格式:XCOPY 〈源路径名〉
4.使用说明:
(1)XCOPY是COPY的扩展,可以把指定的目录连文件和目录结构一并拷贝,但不能拷贝隐藏文件和系统文件;
(2)使用时源盘符、源目标路径名、源文件名至少指定一个;
(3)选用/S时对源目录下及其子目录下的所有文件进行COPY。除非指定/E参数,否则/S不会拷贝空目录,若不指定/S参数,则XCOPY只拷贝源目录本身的文件,而不涉及其下的子目录;
(4)选用/V参数时,对的拷贝的扇区都进行较验,但速度会降低。
(三)TYPE——显示文件内容命令
1.功能:显示ASCII码文件的内容。
2.类型:内部命令。
3.格式:TYPE〈文件名〉
4.使用说明:
(1)显示由ASCII码组成的文本文件,对。EXE.COM等为扩展名的文件,其显示的内容是无法阅读的,没有实际意义2;
(2)该命令一次只可以显示一个文件的内容,不能使用通配符;
(3)如果文件有扩展名,则必须将扩展名写上;
(4)当文件较长,一屏显示不下时,可以按以下格式显示;TYPE〈文件名〉|MORE,MORE为分屏显示命令,使用些参数后当满屏时会暂停,按任意键会继续显示。
(5)若需将文件内容打印出来,可用如下格式:
TYPE〈文件名〉,>PRN
此时,打印机应处于联机状态。
(四) REN——文件改名命令
1.功能:更改文件名称
2.类型:内部命令
3.格式:REN〈旧文件名〉〈新文件名〉
4.使用说明:
(1)新文件名前不可以加上盘符和路径,因为该命令只能对同一盘上的文件更换文件名;
(2)允许使用通配符更改一组文件名或扩展名。
(五)FC——文件比较命令
1.功能:比较文件的异同,并列出差异处。
2.类型:外部命令
3.格式:FC〈文件名〉
4.使用说明:
(1)选用/A参数,为ASCII码比较模式;
(2)选用/B参数,为二进制比较模式;
(3)选用/C参数,将大小写字符看成是相同的字符。
(4)选用/N参数,在ASCII码比较方式下,显示相异处的行号。
(六)ATTRIB——修改文件属性命令
1.功能:修改指定文件的属性。(文件属性参见2.5.4(二)文件属性一节)
2.类型:外部命令。
3.格式:ATTRIB
4.使用说明:
(1)选用R参数,将指定文件设为只读属性,使得该文件只能读取,无法写入数据或删除;选用——R参数,去除只读属性;
(2)选用A参数,将文件设置为档案属性;选用——A参数,去除档案属性; (3)选用H参数,将文件调协为隐含属性;选用——H参数,去隐含属性;
(4)选用S参数,将文件设置为系统属性;选用——S参数,去除系统属性; (5)选用/S参数,对当前目录下的所有子目录及作设置。
七) DEL——删除文件命令
1.功能:删除指定的文件。
2.类型:内部命令
3.格式:DEL〈文件名〉
4.使用说明:
(1)选用/P参数,系统在删除前询问是否真要删除该文件,若不使用这个参数,则自动删除;
(2)该命令不能删除属性为隐含或只读的文件;
(3)在文件名称中可以使用通配符;
(4)若要删除磁盘上的所有文件(DEL*·*或DEL·),则会提示:(Arey ou sure?)(你确定吗?)若回答Y,则进行删除,回答N,则取消此次删除作业。
(八) UNDELETE——恢复删除命令
1.功能:恢复被误删除命令
2.类型:外部命令。
3.格式:UNDELETE〈文件名〉/LIST]
4.使用说明:使用UNDELETE可以使用“*”和“?”通配符。
(1)选用/DOS参数根据目录里残留的记录来恢复文件。由于文件被删除时,目录所记载斩文件名第一个字符会被改为E5,DOS即依据文件开头的E5和其后续的字符来找到欲恢复的文件,所以,UNDELETE会要求用户输入一个字符,以便将文件名字补齐。但此字符不必和原来的一样,只需符合DOS的文件名规则即可。
(2)选用/LIST只“列出”符合指定条件的文件而不做恢复,所以对磁盘内容完全不会有影响。
(3)选用/ALL自动将可完全恢复的文件完全恢复,而不一一地询问用户,使用此参数时,若UNDELTE利用目录里残留的记录来将文件恢复,则会自动选一个字符将文件名补齐,并且使其不与现存文件名相同,选用字符的优选顺序为:#%——0000123456789A~Z。
UNDELETE还具有建立文件的防护措施的功能,已超出本课程授课范围,请读者在使用些功能时查阅有关DOS手册。
七、其它命令
(一)CLS——清屏幕命令
1功能:清除屏幕上的所有显示,光标置于屏幕左上角。
2类型:内部命令
3格式:CLS
(二) VER查看系统版本号命令
1功能:显示当前系统版本号
2类型:内部命令
3格式:VER
(三) DATA日期设置命令
1功能:设置或显示系统日期。
2类型:内部命令
3格式:DATE
4使用说明:
(1)省略显示系统日期并提示输入新的日期,不修改则可直接按回车键,为“月月——日日——年年”格式;
(2)当机器开始启动时,有自动处理文件(AUTOEXEC.BAT)被执行,则系统不提示输入系统日期。否则,提示输入新日期和时间。
(四) TIME系统时钟设置命令
1功能:设置或显示系统时期。
2类型:内部命令
3格式:TIME
4使用说明:
(1)省略,显示系统时间并提示输入新的时间,不修改则可直接按回车键,为“小时:分钟:秒:百分之几秒”格式;
(2)当机器开始启动时,有自动处理文件(AUTOEXEC.BAT)被执行,则系统不提示输入系统日期。否则,提示输入新日期和时间。
(五)MEM查看当前内存状况命令
1功能:显示当前内存使用的情况
2类型:外部命令
3格式:MEM
4使用说明:
(1)选用/C参数列出装入常规内存和CMB的各文件的长度,同时也显示内存空间的使用状况和最大的可用空间;
(2)选用/F参数分别列出当前常规内存剩余的字节大小和UMB可用的区域及大小;
(3)选用/M参数显示该模块使用内存地地址、大小及模块性质;
(4)选用/P参数指定当输出超过一屏时,暂停供用户查看。
(六) MSD显示系统信息命令
1功能:显示系统的硬件和操作系统的状况。
2类型:外部命令
3格式:MSD
4使用说明:
(1)选用/I参数时,不检测硬件;
(2)选用/B参数时,以黑白方式启动MSD;
(3)选用/S参数时,显示出简明的系统报告。
### DOS Command Encyclopedia
#### 1. MD - Create Subdirectory
1. **Function**: Create a new subdirectory
2. **Type**: Internal command
3. **Format**: MD <subdirectory name>
4. **Usage Instructions**:
- (1) "Drive": Specify the disk drive letter of the subdirectory to be created. If omitted, it is the current drive.
- (2) "Pathname": The name of the parent directory of the subdirectory to be created. If omitted, it is created in the current directory.
Example: (1) Create a subdirectory named FOX in the root directory of drive C:; (2) Create a USER subdirectory under the FOX subdirectory.
C:> MD FOX (Create subdirectory FOX under the current drive C:)
C:> MD FOX\USER (Create USER subdirectory under the FOX subdirectory)
#### 2. CD - Change Current Directory
1. **Function**: Display the current directory
2. **Type**: Internal command
3. **Format**: CD
4. **Usage Instructions**:
- (1) If the path and subdirectory name are omitted, the current directory is displayed.
- (2) If the format "CD\" is used, it returns to the root directory.
- (3) If the format "CD.." is used, it returns to the previous level directory.
Example: (1) Enter the USER subdirectory; (2) Return from the USER subdirectory to the subdirectory; (3) Return to the root directory.
C:> CD FOX\USER (Enter the USER subdirectory under the FOX subdirectory)
C:>FOX\USER> CD.. (Return to the previous level root directory)
C:>FOX> CD\ (Return to the root directory)
C:>
#### 3. RD - Delete Subdirectory Command
1. **Function**: Delete the directory from the specified disk.
2. **Type**: Internal command
3. **Format**: RD
4. **Usage Instructions**:
- (1) The subdirectory must be empty before deletion. That is, you need to enter the subdirectory first, use the DEL (delete file command) to empty the files under the subdirectory, then return to the previous level directory, and use the RD command to delete the subdirectory itself.
- (2) The root directory and current directory cannot be deleted.
Example: To delete the USER subdirectory under the FOX subdirectory on drive C:, the operation is as follows:
Step 1: First empty the files under the USER subdirectory;
C:> DEL C:\FOX\USER\*.*
Step 2: Delete the USER subdirectory.
C:> RD C:\FOX\USER
#### 4. DIR - Display Disk Directory Command
1. **Function**: Display the content of the disk directory.
2. **Type**: Internal command
3. **Format**: DIR
4. **Usage Instructions**: Use of /P: When there are too many directories to view and they cannot be displayed on one screen, the screen will keep scrolling up and it is not easy to see clearly. After adding the /P parameter, the file information of 23 lines will be displayed page by page on the screen, then it will pause and prompt; Press any key to continue
Use of /W: Adding /W only displays the file name, and the file size, creation date and time are all omitted. After adding the parameter, five file names can be displayed per line.
#### PATH - Path Setting Command
1. **Function**: Set the search path for executable files, valid only for files.
2. **Type**: Internal command
3. **Format**: PATH directory{, <directory pathname 2>...}
4. **Usage Instructions**:
- (1) When running an executable file, DOS will first search for the file in the current directory. If found, it will run it; if not found, it will search for the file in the directories one by one in the order set by the PATH command.
- (2) In the PATH command, if there are two or more paths, they are separated by a semicolon ";".
- (3) The PATH command has three usage methods:
PATH... (Set the search path for executable files)
PATH: (Cancel all paths)
PATH: (Display the currently set path)
#### 6. TREE - Display Disk Directory Structure Command
1. **Function**: Display all directory paths on the specified drive and all file names under these directories.
2. **Type**: External command
3. **Format**: TREE
4. **Usage Instructions**:
- (1) When using the /F parameter, all directories and all files under the directories are displayed. When omitted, only directories are displayed, and files under the directories are not displayed.
- (2) When using the >PRN parameter, the listed directories and file names in the directories are printed out.
#### 7. DELTREE - Delete Entire Directory Command
1. **Function**: Delete the entire directory and its subordinate subdirectories and files.
2. **Type**: External command
3. **Format**: DELTREE<pathname>
4. **Usage Instructions**: This command can delete the directory and all files, subdirectories, and subdirectories at a lower level at one time. Moreover, regardless of whether the file attribute is hidden, system, or read-only, as long as the file is under the deleted directory, DELTREE will delete it regardless. Use with caution!!!
### 5. Disk Operation Commands
#### 1. format - Disk Formatting Command
1. **Function**: Format the disk, divide tracks and sectors; at the same time, check for defective tracks on the entire disk, mark bad tracks; establish the directory area and file allocation table, so that the disk is ready to receive DOS.
2. **Type**: External command
3. **Format**: format <drive:>
4. **Usage Instructions**:
- (1) The drive letter after the command cannot be omitted. If formatting the hard disk, the following prompt will appear: WARNING: ALL DATA ON NON-REMOVABLE DISK DRIVE C: WILL BE LOST! Proceed with format (Y/N)? (Warning: All data on drive C: will be lost. Do you really want to continue formatting?)
- (2) If formatting a floppy disk, the following prompt will appear: Insert new diskette for drive A; and press ENTER when ready... (Insert a new disk in drive A and press ENTER when ready).
- (3) When using the /S parameter, the DOS system files IO.SYS, MSDOS.SYS, and COMMAND.COM will be copied to the disk, making the disk a DOS boot disk. If the /S parameter is not used, the formatted disk can only read and write information and cannot be used as a boot disk.
- (4) When using the /4 parameter, format a 360KB low-density disk in a 1.2MB high-density floppy drive.
- (5) When using the /Q parameter, format quickly. This parameter does not re-divide the tracks and sectors of the disk. It can only clear the root directory, file allocation table, and boot sector of the disk to blank, so the formatting speed is faster.
- (6) When using the /U parameter, it means unconditional formatting, that is, all data on the original disk is destroyed. Without /U, it is safe formatting. At this time, an image file is first created to save the original FAT table and root directory. If necessary, the original data can be restored using UNFORMAT.
#### 2. UNformat - Restore Formatting Command
1. **Function**: Restore the disk that has lost data due to misoperation of formatting.
2. **Type**: External command
3. **Format**: UNformat <drive>
4. **Usage Instructions**: Used to restore the disk formatted "non-destructively". When the files or subdirectories deleted in the root directory or the system sectors (including FAT, root directory, BOOT sector, and hard disk partition table) of the disk are damaged, UNformat can also be used to rescue.
- (1) When using the /L parameter, the found subdirectory names, file names, sizes, dates, etc. are listed, but the format work will not really be done.
- (2) When using the /P parameter, the report displayed on the screen (including the information generated by the /L parameter) is also sent to the printer. When running, the screen will display: "Print out will be sent to LPT1"
- (3) When using the /TEST parameter, only a simulation test (TEST) is done, and no real writing action is done. When using this parameter, the screen will display: "Simulation only"
- (4) When using the /U parameter, the data of the MIRROR image file is not used, and UNformat is directly performed according to the current status of the disk.
- (5) When adding /P, /L, /TEST one of them after the drive letter, it is equivalent to using the /U parameter, and UNformat will "assume" that there is no MIRROR image file on the disk at this time.
Note: UNformat can completely restore the disk just formatted. But if other data is written after formatting, UNformat cannot completely rescue the data. UNformat is not omnipotent. Since UNformat will rebuild the FAT and root directory, it also has a high risk. Improper operation may expand the loss. If only a few files or subdirectories are deleted by mistake, only UNDELETE is needed.
#### 3. CHKDSK - Check Disk Current Status Command
1. **Function**: Display the disk status, memory status, and the number of discontinuous files in the specified file under the specified path.
2. **Type**: External command
3. **Format**: CHKDSK
4. **Usage Instructions**:
- (1) When using the parameter, the situation of the file occupying the disk is displayed.
- (2) When using the /F parameter, correct the logical errors found on the specified disk.
- (3) When using the /V parameter, all files and paths on the disk are displayed.
#### 4. DISKCOPY - Whole Disk Copy Command
1. **Function**: Copy floppy disks with completely the same format and content.
2. **Type**: External command
3. **Format**: DISKCOPY
4. **Usage Instructions**:
- (1) If the target floppy disk is not formatted, the system will automatically format it during copying.
- (2) If there are original files on the target floppy disk, all will be lost after copying.
- (3) If copying with a single drive, the system will prompt to replace the source disk and target disk in time. Please pay attention to distinguish between the source disk and target disk during operation.
#### 5. LABEL - Establish Disk Volume Label Command
1. **Function**: Establish, change, and delete the disk volume label.
2. **Type**: External command
3. **Format**: LABEL
4. **Usage Instructions**:
- (1) The volume label name is the volume label name to be established. If this parameter is omitted, the system will prompt to enter the volume label name or ask whether to delete the original volume label name.
- (2) The volume label name consists of 1 to 11 characters.
#### 6. VOL - Display Disk Volume Label Command
1. **Function**: View the disk volume label number.
2. **Type**: Internal command
3. **Format**: VOL
4. **Usage Instructions**: Omit the drive letter to display the volume label of the current drive.
#### 7. SCANDISK - Detect and Repair Disk Command
1. **Function**: Detect whether there are problems with the FAT table, directory structure, file system, etc. of the disk, and can repair the detected problems.
2. **Type**: External command
3. **Format**: SCANDISK{...}
4. **Usage Instructions**:
- (1) CCANDISK is applicable to hard disks and floppy disks. Multiple disks can be specified at one time or the /ALL parameter can be used to specify all disks.
- (2) It can automatically detect logical errors such as cross-connections, lost clusters, and directory structures in the disk and repair them.
#### 8. DEFRAG - Defragment Disk Command
1. **Function**: Organize the disk and eliminate disk fragments.
2. **Type**: External command
3. **Format**: DEFRAG
4. **Usage Instructions**: When using the /F parameter, the fragments in the files on the disk are eliminated, and the arrangement of the disk files is adjusted to ensure that there are no gaps between the files. Thereby, the disk reading speed is accelerated and the disk space is saved.
#### 9. SYS - System Copy Command
1. **Function**: Transfer the DOS system files IO.SYS, MSDOS.SYS, and COMMAND.COM on the current drive to the specified drive.
2. **Type**: External command
3. **Format**: SYS
* **Usage Instructions**: If there is not enough free space on the disk to store the system files, the prompt: No room for on destination disk. will be displayed.
### File Operation Commands
#### 1. COPY - File Copy Command
1. **Function**: Copy one or more files to the specified disk.
2. **Type**: Internal command
3. **Format**: COPY <source filename>
4. **Usage Instructions**:
- (1) COPY is a file-to-file way to copy data. The target disk must have been formatted before copying.
- (2) During the copying process, the old file with the same file name on the target disk will be replaced by the source file.
- (3) When copying a file, make sure that the target disk has enough space in advance, otherwise the error message insufficient will be displayed, prompting that the disk space is not enough.
- (4) Wildcards "*" and "?" are allowed in the file name, and multiple files can be copied at the same time.
- (5) The source filename in the COPY command must be specified and cannot be omitted.
- (6) When copying, the target filename can be the same as the source filename, which is called "same-name copy". At this time, the target filename can be omitted.
- (7) When copying, the target filename can also be different from the source filename, which is called "different-name copy". At this time, the target filename cannot be omitted.
- (8) When copying, several files can also be merged into one file, called "merged copy". The format is as follows: COPY; <source filename 1> <source filename 2>... <target filename>;
- (9) Using the COPY command, data can also be input from the keyboard to create a file. The format is as follows: COPY CON <filename>;
- (10) Note: For the usage format of the COPY command, there must be a space between the source filename and the target filename!
#### 2. XCOPY - Directory Copy Command
1. **Function**: Copy the specified directory and all files under the directory together with the directory structure.
2. **Type**: External command
3. **Format**: XCOPY <source pathname>
4. **Usage Instructions**:
- (1) XCOPY is an extension of COPY. It can copy the specified directory, files, and directory structure at one time, but cannot copy hidden files and system files.
- (2) When using, at least one of the source drive letter, source target pathname, and source filename must be specified.
- (3) When using /S, all files under the source directory and its subdirectories are copied. Unless the /E parameter is specified, /S will not copy empty directories. If the /S parameter is not specified, XCOPY only copies the files in the source directory itself and does not involve its subdirectories.
- (4) When using the /V parameter, all copied sectors are verified, but the speed will be reduced.
#### 3. TYPE - Display File Content Command
1. **Function**: Display the content of an ASCII code file.
2. **Type**: Internal command.
3. **Format**: TYPE <filename>
4. **Usage Instructions**:
- (1) Display the text file composed of ASCII code. For files with extensions such as.EXE.COM, the displayed content is unreadable and has no practical meaning.
- (2) This command can only display the content of one file at a time, and wildcards cannot be used.
- (3) If the file has an extension, the extension must be written.
- (4) When the file is long and cannot be displayed on one screen, it can be displayed in the following format; TYPE <filename>|MORE, MORE is the command for page-by-page display. After using this parameter, when the screen is full, it will pause, and pressing any key will continue to display.
- (5) If the content of the file needs to be printed, the following format can be used:
TYPE <filename>,>PRN
At this time, the printer should be in the online state.
#### 4. REN - File Rename Command
1. **Function**: Change the file name.
2. **Type**: Internal command
3. **Format**: REN <old filename> <new filename>
4. **Usage Instructions**:
- (1) The new filename cannot be prefixed with a drive letter and path, because this command can only change the filename of the file on the same disk.
- (2) Wildcards are allowed to change a group of filenames or extensions.
#### 5. FC - File Comparison Command
1. **Function**: Compare the differences between files and list the differences.
2. **Type**: External command
3. **Format**: FC <filename>
4. **Usage Instructions**:
- (1) When using the /A parameter, it is the ASCII code comparison mode.
- (2) When using the /B parameter, it is the binary comparison mode.
- (3) When using the /C parameter, uppercase and lowercase characters are regarded as the same characters.
- (4) When using the /N parameter, in the ASCII code comparison mode, the line number of the different place is displayed.
#### 6. ATTRIB - Modify File Attribute Command
1. **Function**: Modify the attribute of the specified file. (File attributes refer to the "File Attributes" section of 2.5.4 (2))
2. **Type**: External command.
3. **Format**: ATTRIB
4. **Usage Instructions**:
- (1) When using the R parameter, set the specified file to read-only attribute, so that the file can only be read, and data cannot be written or deleted; when using --R parameter, remove the read-only attribute.
- (2) When using the A parameter, set the file to archive attribute; when using --A parameter, remove the archive attribute.
- (3) When using the H parameter, set the file to hidden attribute; when using --H parameter, remove the hidden attribute.
- (4) When using the S parameter, set the file to system attribute; when using --S parameter, remove the system attribute.
- (5) When using the /S parameter, set for all subdirectories under the current directory.
#### 7. DEL - Delete File Command
1. **Function**: Delete the specified file.
2. **Type**: Internal command
3. **Format**: DEL <filename>
4. **Usage Instructions**:
- (1) When using the /P parameter, the system asks whether to really delete the file before deletion. If this parameter is not used, it is deleted automatically.
- (2) This command cannot delete files with hidden or read-only attributes.
- (3) Wildcards can be used in the file name.
- (4) If you want to delete all files on the disk (DEL*.* or DEL.), the prompt: (Are you sure?) (Are you sure?) will appear. If you answer Y, deletion will be performed; if you answer N, this deletion operation will be canceled.
#### 8. UNDELETE - Restore Delete Command
1. **Function**: Restore the file deleted by mistake.
2. **Type**: External command.
3. **Format**: UNDELETE <filename>/LIST]
4. **Usage Instructions**: UNDELETE can use the "*" and "?" wildcards.
- (1) When using the /DOS parameter, the file is restored according to the residual records in the directory. When the file is deleted, the first character of the filename recorded in the directory will be changed to E5. DOS finds the file to be restored according to E5 at the beginning of the file and its subsequent characters. Therefore, UNDELETE will ask the user to enter a character to complete the filename. But this character does not need to be the same as the original one, as long as it conforms to the DOS filename rules.
- (2) When using /LIST, only the files that meet the specified conditions are "listed" and not restored, so it has no impact on the disk content at all.
- (3) When using /ALL, the files that can be completely restored are automatically completely restored without asking the user one by one. When using this parameter, if UNDELTE restores the file using the residual records in the directory, it will automatically select a character to complete the filename and make it not the same as the existing filename. The preferred order of selecting characters is: #%——0000123456789A~Z.
UNDELETE also has the function of establishing file protection measures, which is beyond the scope of this course. Please refer to the relevant DOS manual when using this function.
### 7. Other Commands
#### 1. CLS - Clear Screen Command
1. **Function**: Clear all displays on the screen, and the cursor is placed at the top left corner of the screen.
2. **Type**: Internal command
3. **Format**: CLS
#### 2. VER - View System Version Number Command
1. **Function**: Display the current system version number.
2. **Type**: Internal command
3. **Format**: VER
#### 3. DATE - Date Setting Command
1. **Function**: Set or display the system date.
2. **Type**: Internal command
3. **Format**: DATE
4. **Usage Instructions**:
- (1) Omit to display the system date and prompt to enter a new date. If not modified, you can directly press the ENTER key. is in the format "month-month-day-day-year-year".
- (2) When the automatic processing file (AUTOEXEC.BAT) is executed when the machine starts, the system will not prompt to enter the system date. Otherwise, it will prompt to enter a new date and time.
#### 4. TIME - System Clock Setting Command
1. **Function**: Set or display the system date and time.
2. **Type**: Internal command
3. **Format**: TIME
4. **Usage Instructions**:
- (1) Omit to display the system time and prompt to enter a new time. If not modified, you can directly press the ENTER key. is in the format "hour:minute:second:hundredths of a second".
- (2) When the automatic processing file (AUTOEXEC.BAT) is executed when the machine starts, the system will not prompt to enter the system date. Otherwise, it will prompt to enter a new date and time.
#### 5. MEM - View Current Memory Status Command
1. **Function**: Display the current memory usage.
2. **Type**: External command
3. **Format**: MEM
4. **Usage Instructions**:
- (1) When using the /C parameter, list the lengths of each file loaded into conventional memory and CMB, and also display the memory space usage and the largest available space.
- (2) When using the /F parameter, list the remaining bytes of the current conventional memory and the available areas and sizes of UMB respectively.
- (3) When using the /M parameter, display the memory address, size, and module nature of the module.
- (4) When using the /P parameter, specify that when the output exceeds one screen, it will pause for the user to view.
#### 6. MSD - Display System Information Command
1. **Function**: Display the status of the system hardware and operating system.
2. **Type**: External command
3. **Format**: MSD
4. **Usage Instructions**:
- (1) When using the /I parameter, the hardware is not detected.
- (2) When using the /B parameter, MSD is started in black and white mode.
- (3) When using the /S parameter, a concise system report is displayed.
|