Sender: liuxf (Hiten Mitsurugi-ryū), Board: DOS
Title: Detailed Explanation of Some MS-DOS 6.22 Commands
Posting station: BBS Shuimu Tsinghua Station (Sun Apr 22 21:53:53 2001)
Detailed Explanation of Some MS-DOS 6.22 Commands
Displays or changes file attributes.
ATTRIB filename]
+ Sets an attribute.
- Clears an attribute.
R Read-only attribute.
A Archive attribute.
S System file.
H Hidden attribute.
/S Operates on all files under the specified directory.
Sets or clears CTRL+C checking.
BREAK
Typing BREAK without parameters displays the status of BREAK.
Calls a batch file from within a batch file.
CALL filename
batch-parameters Specifies the command-line parameters required by the batch file.
Displays or changes the current directory.
CHDIR
CHDIR
CD
CD
.. Means changing the current directory to the parent directory.
Typing CD displays the current directory of the specified drive.
Typing CD without parameters displays the current drive and current directory.
Displays or sets the code page.
CHCP
nnn Specifies a code page number
Typing CHCP without parameters displays the current code page number.
Checks a disk and reports the results.
CHKDSK filename]
Specifies the disk and path to check.
filename Specifies the file to check.
/F Fixes disk errors.
/V Displays the full path of all files on the disk.
Typing CHKDSK without parameters checks the current disk.
Besides using CHKDSK, you can also use SCANDISK. SCANDISK can check and fix a wider range of errors.
Type HELP SCANDISK at the prompt to get more information
Clears the screen.
CLS
Starts a new command interpreter.
COMMAND path] ]
]
path Specifies the directory containing the COMMAND.COM file.
device Specifies the input and output device for commands.
/E:nnnnn Sets the initial environment variable space to nnnnn bytes.
/P Specifies the new command interpreter as resident (cannot exit).
/MSG Stores all error messages in memory (requires the /P option).
/Y Executes a batch file.
/C command Executes the command specified by command and returns.
/K command Executes the command specified by command and continues running.
The /P and /MSG switches can only be used when the SHELL command in CONFIG.SYS starts the COMMAND command.
File copying.
COPY source ]
]
source Specifies the file to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and filename of the new file.
/V Verifies whether the new file is correct.
/Y Does not prompt for confirmation before overwriting a destination file with the same name.
/-Y Prompts for confirmation before overwriting a destination file with the same name.
The /Y switch can be preset by the COPYCMD environment variable.
To merge multiple files, you can specify a single destination file, but specify multiple
source files (using wildcards or the file1+file2+file3 format).
Verify file readability: copy *.* nul
Delete copy nul a.txt
Display copy *.bat con
Changes the terminal device.
CTTY device
Displays or sets the date.
DATE
month-day-year Sets the specified date.
Typing DATE without parameters displays the current date and prompts you to enter a new date.
Displays a list of files and subdirectories.
DIR attribs]] sortord]]
]
Specifies the drive, directory, or file to list.
/P Pauses after displaying one screen of information.
/W Uses wide list format.
/A Displays files with the specified attributes.
attribs D Directory R Read-only file H Hidden file
S System file A Files ready for archiving - Prefix, means "not"
/O Lists files after sorting.
sortord N By filename (alphabetical order) S By size (small files first)
E By extension (alphabetical order) D By date and time (earlier-created files first)
G List subdirectories first - Prefix, means reverse order
C By compression ratio (files with smaller ratio first)
/S Displays all files and subdirectories under the specified directory.
/B Uses bare format (no heading information or statistics).
/L Uses lowercase letters.
/C Displays the file compression ratio. /CH uses the host allocation unit size.
Switches can be preset with the DIRCMD environment variable.
Use a hyphen (-) to override preset switches, for example /-W.
Copies one disk to another.
DISKCOPY ]
/1 Copies only the first side of the disk.
/V Verifies whether the copied information is correct.
/M Forces DISKCOPY to use only memory for intermediate information.
The two disks must be of the same type.
The source disk and destination disk can be specified in the same drive.
Deletes files.
DEL filename
ERASE filename
filename Specifies the file to be deleted; use wildcards to specify multiple files.
/P Displays a confirmation message before deleting each file.
Exits the COMMAND.COM command interpreter.
EXIT
Executes a specified command for each file in a set of files.
FOR %variable IN (set) DO command
%variable Specifies a replaceable parameter.
(set) Specifies a set of files containing one or more files; wildcards may be used.
command Specifies the command to execute for each file.
command-parameters Specifies parameters or switches for the command.
When using the FOR command in a batch file, replace it with %%varible.
Formats an MS-DOS format disk.
FORMAT drive: ]
FORMAT drive: ]
FORMAT drive: ]
FORMAT drive:
/V Specifies the volume label;
/Q Performs a quick format;
/U Performs an unconditional format (cannot be recovered with UNFORMAT);
/F:size Specifies the floppy disk format capacity (such as 160,180
, 320, 360, 720, 1.2, 1.44, 2.88).
/B Allocates space for system files.
/S Copies system files to the disk.
/T:tracks Specifies the tracks per side of the disk.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single-sided floppy disk.
Directs MS-DOS to a labelled line in a batch program.
GOTO label
label Specifies the text string used as a label in the batch file.
The label occupies a line by itself and begins with a colon.
Conditional statements in batch files.
IF ERRORLEVEL number command
IF string1==string2 command
IF EXIST filename command
NOT Tells MS-DOS to execute the command only when the condition is not true.
ERRORLEVEL number The condition is true if the exit code returned by the previous program is greater than or equal to the specified value.
command Specifies the command to be executed when the condition is satisfied.
string1==string2 The condition is true if the text strings match.
EXIST filename The condition is true if the specified file exists.
Loads a program above the first 64K of memory and runs it.
LOADFIX filename
When running a program encounters "Packed file corrupt", use LOADFIX to load the program.
Loads a program into the upper memory area.
LOADHIGH filename
LOADHIGH ...] ]
filename
/L:region1]...
Specifies the memory area for loading the program; Region1 specifies the first memory area number.
minsize1 specifies the minimum size of region1 (if any).
Region2 and minsize2 specify the second memory block number and minimum size (if any).
The number of memory areas is unlimited.
/S When loading the program, shrinks UMB to the minimum size.
/S is usually used only for MemMake.
filename Specifies the name and location of the program.
parameters Specifies the command-line parameters required by the program
Displays memory usage.
MEM
/CLASSIFY or /C Classifies programs by memory usage, listing used space and maximum available space.
/DEBUG or /D Displays information about each memory module and driver device, plus other information.
/FREE or /F Displays free space in upper memory and conventional memory
/MODULE or /M Detailed list of memory module usage
/PAGE or /P Pauses when scrolling
Use MOVE to change the name of a directory, or move files to another directory.
move \txt \txt1
Pauses execution of a batch file and displays "Press any key to continue..."
PAUSE
Background printing command
PRINT
filename]
/D:device Specifies the printing device.
/B:size Sets the internal buffer size (bytes).
/U:ticks1 Sets the maximum time slices to wait for printing
/M:ticks2 Sets the maximum time slices to print one character
/S:ticks3 Reserved waiting.
/Q:qsize Sets the maximum number of files in the print queue.
/T Cancels printing of the print queue.
/C Cancels printing of the current file and subsequent files.
/P Adds a file to the print queue.
Typing PRINT without parameters displays the contents of the print queue.
Changes the MS-DOS prompt.
PROMPT
text Specifies the new command prompt.
The prompt consists of ordinary characters and the following special codes:
$Q = (equal sign)
$$ $ (dollar sign)
$T Current time
$D Current date
$P Current drive and path
$V MS-DOS version number
$N Current drive
$G > (greater-than sign)
$L < (less-than sign)
$B | (pipe)
$H Backspace (erases the previous character)
$E Escape code (ASCII code 27)
$- Carriage return and line feed
Typing PROMPT directly can change the prompt back to the default setting.
Deletes a directory.
RMDIR path
RD path
Records comments in a batch file or CONFIG.SYS.
REM
Changes a filename.
RENAME file1 file2
REN file1 file2
Note that you cannot specify a new drive or path for the destination file.
Restores files backed up with the BACKYP command.
RESTORE drive1: drive2:]
drive1: Specifies the drive containing the backup files.
drive2:] Specifies the file to restore.
/S Restores all files, including those in subdirectories.
/P Prompts before restoring read-only or files (normal attribute) that have been modified since the last backup.
/B Restores files modified before the specified date.
/A Restores files modified after the specified date.
/E Restores files modified before the specified time.
/L Restores files modified after the specified time.
/M Restores files modified since the last backup.
/N Restores files that do not exist on the destination disk.
Installs file sharing and the ability to lock files on disk and network devices.
SHARE
/F:space Sets the storage area space for file sharing information (in bytes).
/L:locks Sets the number of files that can be locked simultaneously.
Changes the position of replaceable parameters in a batch file.
SHIFT
Sorts input and then outputs the result to the screen, a file, or another device.
SORT filename2]
SORT filename2]
/R Reverse sort; that is, sort in order from Z to A, from 9 to 0.
/+n Sorts the file order alphabetically by the nth column.
filename1 Specifies the file to be sorted.
filename2 Specifies a file to store the sorted result.
command Specifies a command and sorts its output.
Substitutes a path with a virtual drive.
SUBST path]
SUBST drive1: /D
drive1: Specifies a virtual drive letter.
path Specifies the full path to be substituted as a drive
/D Deletes the virtual drive
Typing SUBST without parameters displays the current list of virtual drives.
Copies the MS-DOS system.
SYS drive2:
Source system path
drive2: Destination disk to be copied to
Displays or sets the time.
TIME
Typing TIME without parameters displays the current time,
and prompts you to enter a new time; press ENTER to keep the original time.
Displays the contents of a text file.
TYPE filename
con Creates a file named filename
nul Creates a zero-length file
drive2 Copies the file
Tells MS-DOS whether to verify correctness when files are written to disk
VERIFY
Typing VERIFY without parameters displays the current setting of VERIFY.
Copies files (excluding hidden and system files) and directory trees.
XCOPY source
source Specifies the files to be copied.
destination Specifies the name and location of the new files.
/A Copies files with the archive attribute and does not change the attribute.
/M Copies files with the archive attribute and turns off the attribute.
/D:date Copies files modified on or after the given date.
/P Prompts before copying each file.
/S Copies directories and subdirectories (excluding empty directories).
/E Copies all subdirectories (including empty directories).
/V Verifies each new file.
/W Prompts you to press a key before copying.
/Y Prompts for confirmation before overwriting a destination file with the same name.
/-Y Does not prompt for confirmation before overwriting a destination file with the same name.
The /Y switch can be preset by the COPYCMD environment variable.
Setting /Y on the command line can change the preset item
--
※ Source: ·BBS Shuimu Tsinghua Station smth.org·
(This article was copied using the S-Term article copy script)
==================================================
Title: Detailed Explanation of Some MS-DOS 6.22 Commands
Posting station: BBS Shuimu Tsinghua Station (Sun Apr 22 21:53:53 2001)
Detailed Explanation of Some MS-DOS 6.22 Commands
Displays or changes file attributes.
ATTRIB filename]
+ Sets an attribute.
- Clears an attribute.
R Read-only attribute.
A Archive attribute.
S System file.
H Hidden attribute.
/S Operates on all files under the specified directory.
Sets or clears CTRL+C checking.
BREAK
Typing BREAK without parameters displays the status of BREAK.
Calls a batch file from within a batch file.
CALL filename
batch-parameters Specifies the command-line parameters required by the batch file.
Displays or changes the current directory.
CHDIR
CHDIR
CD
CD
.. Means changing the current directory to the parent directory.
Typing CD displays the current directory of the specified drive.
Typing CD without parameters displays the current drive and current directory.
Displays or sets the code page.
CHCP
nnn Specifies a code page number
Typing CHCP without parameters displays the current code page number.
Checks a disk and reports the results.
CHKDSK filename]
Specifies the disk and path to check.
filename Specifies the file to check.
/F Fixes disk errors.
/V Displays the full path of all files on the disk.
Typing CHKDSK without parameters checks the current disk.
Besides using CHKDSK, you can also use SCANDISK. SCANDISK can check and fix a wider range of errors.
Type HELP SCANDISK at the prompt to get more information
Clears the screen.
CLS
Starts a new command interpreter.
COMMAND path] ]
]
path Specifies the directory containing the COMMAND.COM file.
device Specifies the input and output device for commands.
/E:nnnnn Sets the initial environment variable space to nnnnn bytes.
/P Specifies the new command interpreter as resident (cannot exit).
/MSG Stores all error messages in memory (requires the /P option).
/Y Executes a batch file.
/C command Executes the command specified by command and returns.
/K command Executes the command specified by command and continues running.
The /P and /MSG switches can only be used when the SHELL command in CONFIG.SYS starts the COMMAND command.
File copying.
COPY source ]
]
source Specifies the file to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
destination Specifies the directory and filename of the new file.
/V Verifies whether the new file is correct.
/Y Does not prompt for confirmation before overwriting a destination file with the same name.
/-Y Prompts for confirmation before overwriting a destination file with the same name.
The /Y switch can be preset by the COPYCMD environment variable.
To merge multiple files, you can specify a single destination file, but specify multiple
source files (using wildcards or the file1+file2+file3 format).
Verify file readability: copy *.* nul
Delete copy nul a.txt
Display copy *.bat con
Changes the terminal device.
CTTY device
Displays or sets the date.
DATE
month-day-year Sets the specified date.
Typing DATE without parameters displays the current date and prompts you to enter a new date.
Displays a list of files and subdirectories.
DIR attribs]] sortord]]
]
Specifies the drive, directory, or file to list.
/P Pauses after displaying one screen of information.
/W Uses wide list format.
/A Displays files with the specified attributes.
attribs D Directory R Read-only file H Hidden file
S System file A Files ready for archiving - Prefix, means "not"
/O Lists files after sorting.
sortord N By filename (alphabetical order) S By size (small files first)
E By extension (alphabetical order) D By date and time (earlier-created files first)
G List subdirectories first - Prefix, means reverse order
C By compression ratio (files with smaller ratio first)
/S Displays all files and subdirectories under the specified directory.
/B Uses bare format (no heading information or statistics).
/L Uses lowercase letters.
/C Displays the file compression ratio. /CH uses the host allocation unit size.
Switches can be preset with the DIRCMD environment variable.
Use a hyphen (-) to override preset switches, for example /-W.
Copies one disk to another.
DISKCOPY ]
/1 Copies only the first side of the disk.
/V Verifies whether the copied information is correct.
/M Forces DISKCOPY to use only memory for intermediate information.
The two disks must be of the same type.
The source disk and destination disk can be specified in the same drive.
Deletes files.
DEL filename
ERASE filename
filename Specifies the file to be deleted; use wildcards to specify multiple files.
/P Displays a confirmation message before deleting each file.
Exits the COMMAND.COM command interpreter.
EXIT
Executes a specified command for each file in a set of files.
FOR %variable IN (set) DO command
%variable Specifies a replaceable parameter.
(set) Specifies a set of files containing one or more files; wildcards may be used.
command Specifies the command to execute for each file.
command-parameters Specifies parameters or switches for the command.
When using the FOR command in a batch file, replace it with %%varible.
Formats an MS-DOS format disk.
FORMAT drive: ]
FORMAT drive: ]
FORMAT drive: ]
FORMAT drive:
/V Specifies the volume label;
/Q Performs a quick format;
/U Performs an unconditional format (cannot be recovered with UNFORMAT);
/F:size Specifies the floppy disk format capacity (such as 160,180
, 320, 360, 720, 1.2, 1.44, 2.88).
/B Allocates space for system files.
/S Copies system files to the disk.
/T:tracks Specifies the tracks per side of the disk.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single-sided floppy disk.
Directs MS-DOS to a labelled line in a batch program.
GOTO label
label Specifies the text string used as a label in the batch file.
The label occupies a line by itself and begins with a colon.
Conditional statements in batch files.
IF ERRORLEVEL number command
IF string1==string2 command
IF EXIST filename command
NOT Tells MS-DOS to execute the command only when the condition is not true.
ERRORLEVEL number The condition is true if the exit code returned by the previous program is greater than or equal to the specified value.
command Specifies the command to be executed when the condition is satisfied.
string1==string2 The condition is true if the text strings match.
EXIST filename The condition is true if the specified file exists.
Loads a program above the first 64K of memory and runs it.
LOADFIX filename
When running a program encounters "Packed file corrupt", use LOADFIX to load the program.
Loads a program into the upper memory area.
LOADHIGH filename
LOADHIGH ...] ]
filename
/L:region1]...
Specifies the memory area for loading the program; Region1 specifies the first memory area number.
minsize1 specifies the minimum size of region1 (if any).
Region2 and minsize2 specify the second memory block number and minimum size (if any).
The number of memory areas is unlimited.
/S When loading the program, shrinks UMB to the minimum size.
/S is usually used only for MemMake.
filename Specifies the name and location of the program.
parameters Specifies the command-line parameters required by the program
Displays memory usage.
MEM
/CLASSIFY or /C Classifies programs by memory usage, listing used space and maximum available space.
/DEBUG or /D Displays information about each memory module and driver device, plus other information.
/FREE or /F Displays free space in upper memory and conventional memory
/MODULE or /M Detailed list of memory module usage
/PAGE or /P Pauses when scrolling
Use MOVE to change the name of a directory, or move files to another directory.
move \txt \txt1
Pauses execution of a batch file and displays "Press any key to continue..."
PAUSE
Background printing command
filename]
/D:device Specifies the printing device.
/B:size Sets the internal buffer size (bytes).
/U:ticks1 Sets the maximum time slices to wait for printing
/M:ticks2 Sets the maximum time slices to print one character
/S:ticks3 Reserved waiting.
/Q:qsize Sets the maximum number of files in the print queue.
/T Cancels printing of the print queue.
/C Cancels printing of the current file and subsequent files.
/P Adds a file to the print queue.
Typing PRINT without parameters displays the contents of the print queue.
Changes the MS-DOS prompt.
PROMPT
text Specifies the new command prompt.
The prompt consists of ordinary characters and the following special codes:
$Q = (equal sign)
$$ $ (dollar sign)
$T Current time
$D Current date
$P Current drive and path
$V MS-DOS version number
$N Current drive
$G > (greater-than sign)
$L < (less-than sign)
$B | (pipe)
$H Backspace (erases the previous character)
$E Escape code (ASCII code 27)
$- Carriage return and line feed
Typing PROMPT directly can change the prompt back to the default setting.
Deletes a directory.
RMDIR path
RD path
Records comments in a batch file or CONFIG.SYS.
REM
Changes a filename.
RENAME file1 file2
REN file1 file2
Note that you cannot specify a new drive or path for the destination file.
Restores files backed up with the BACKYP command.
RESTORE drive1: drive2:]
drive1: Specifies the drive containing the backup files.
drive2:] Specifies the file to restore.
/S Restores all files, including those in subdirectories.
/P Prompts before restoring read-only or files (normal attribute) that have been modified since the last backup.
/B Restores files modified before the specified date.
/A Restores files modified after the specified date.
/E Restores files modified before the specified time.
/L Restores files modified after the specified time.
/M Restores files modified since the last backup.
/N Restores files that do not exist on the destination disk.
Installs file sharing and the ability to lock files on disk and network devices.
SHARE
/F:space Sets the storage area space for file sharing information (in bytes).
/L:locks Sets the number of files that can be locked simultaneously.
Changes the position of replaceable parameters in a batch file.
SHIFT
Sorts input and then outputs the result to the screen, a file, or another device.
SORT filename2]
SORT filename2]
/R Reverse sort; that is, sort in order from Z to A, from 9 to 0.
/+n Sorts the file order alphabetically by the nth column.
filename1 Specifies the file to be sorted.
filename2 Specifies a file to store the sorted result.
command Specifies a command and sorts its output.
Substitutes a path with a virtual drive.
SUBST path]
SUBST drive1: /D
drive1: Specifies a virtual drive letter.
path Specifies the full path to be substituted as a drive
/D Deletes the virtual drive
Typing SUBST without parameters displays the current list of virtual drives.
Copies the MS-DOS system.
SYS drive2:
Source system path
drive2: Destination disk to be copied to
Displays or sets the time.
TIME
Typing TIME without parameters displays the current time,
and prompts you to enter a new time; press ENTER to keep the original time.
Displays the contents of a text file.
TYPE filename
con Creates a file named filename
nul Creates a zero-length file
drive2 Copies the file
Tells MS-DOS whether to verify correctness when files are written to disk
VERIFY
Typing VERIFY without parameters displays the current setting of VERIFY.
Copies files (excluding hidden and system files) and directory trees.
XCOPY source
source Specifies the files to be copied.
destination Specifies the name and location of the new files.
/A Copies files with the archive attribute and does not change the attribute.
/M Copies files with the archive attribute and turns off the attribute.
/D:date Copies files modified on or after the given date.
/P Prompts before copying each file.
/S Copies directories and subdirectories (excluding empty directories).
/E Copies all subdirectories (including empty directories).
/V Verifies each new file.
/W Prompts you to press a key before copying.
/Y Prompts for confirmation before overwriting a destination file with the same name.
/-Y Does not prompt for confirmation before overwriting a destination file with the same name.
The /Y switch can be preset by the COPYCMD environment variable.
Setting /Y on the command line can change the preset item
--
※ Source: ·BBS Shuimu Tsinghua Station smth.org·
(This article was copied using the S-Term article copy script)
==================================================
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| zzz19760225 | +2 | 2017-09-21 02:35 |
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器

DigestI