中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 18:06
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Complete list of DOS commands
Printable Version  6,469 / 25
Floor1 beibeichina Posted 2005-12-03 16:05
新手上路 Posts 1 Credits 6 From 辽宁省大连市
### 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.
Floor2 220110 Posted 2005-12-03 19:20
荣誉版主 Posts 313 Credits 718
Encourage the poster!

Does anyone know if there is a "MSD" command? Where can it be found?
I only know that in XP and 2003 there is the "SYSTEMINFO" command to view system information, but it's not very complete!
Floor3 Michael Posted 2005-12-03 23:52
钻石会员 Posts 3,041 Credits 10,056
MSD is a full-screen system information viewing software. It only exists in old versions of MS-DOS.
Floor4 xusong Posted 2005-12-04 01:44
新手上路 Posts 1 Credits 2
It's not easy to remember all of them. After all, it's not used on hand frequently
Floor5 JonePeng Posted 2005-12-04 22:19
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Old textbooks, all are basic commands of MSDOS 6.22. Some commands like MSD, Undelete, Unformat are not recommended to use in MSDOS 7.1 and Windows systems after Win2000.
Floor6 chenyy Posted 2005-12-05 10:56
初级用户 Posts 49 Credits 143
Floor7 lanyu008 Posted 2005-12-12 00:22
新手上路 Posts 7 Credits 13 From 广西柳州
Why can't I use the Deltree command? The system says the command doesn't exist.
Floor8 JonePeng Posted 2005-12-12 13:49
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
Originally posted by lanyu008 at 2005-12-12 00:22:
Why can't I use the Deltree command? The system says the command doesn't exist.

One possibility is that you tried to use this command in the CMD of Windows 2000/XP/2003 systems, but these systems no longer have the Deltree command; instead, the RD /S command is used.

Another possibility is that you were using it in pure DOS or the MSDOS mode of Win9x, but there is no Deltree.com program, or the PATH variable does not define the path where the Deltree program is located.
Floor9 lanyu008 Posted 2005-12-12 18:01
新手上路 Posts 7 Credits 13 From 广西柳州
Yes, my family's is XP, and indeed using RD /S solved it. Thanks~~
Floor10 lijinkai Posted 2005-12-16 10:36
新手上路 Posts 4 Credits 8 From 渭南
Floor11 scandisk Posted 2005-12-20 10:43
初级用户 Posts 11 Credits 20
Support, the original poster has worked hard...
Floor12 aldenfish Posted 2006-04-08 17:54
初级用户 Posts 18 Credits 135
So many commands! It's really multi-functional!!
Floor13 chinacng Posted 2006-04-27 15:58
新手上路 Posts 2 Credits 4
Learned another trick, thanks
Floor14 diypyh Posted 2006-04-28 21:30
初级用户 Posts 13 Credits 54
Thanks
Floor15 wskgxwyg2000 Posted 2006-05-18 12:35
新手上路 Posts 2 Credits 4
Thank you, LZ, you've worked hard!
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023