China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-13 05:17
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Explanation of DOS Commands (I'm also a novice) View 2,475 Replies 29
Original Poster Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Let's start with dir

DIR attributes]]
sortorder]] timefield]]


Specifies the drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D directory R read-only file
H hidden file A file ready for archiving
S system file - prefix meaning "not"
/B Uses bare format (no header information or summary).
/C Displays thousand separator in file sizes. This is the default. Use /-C to
disable separator display.
/D Same as wide but files are listed in columns.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O Lists files in sorted order.
sortorder N by name (alphabetic) S by size (smallest first)
E by extension (alphabetic) D by date/time (oldest first)
G directories first - prefix to reverse order
/P Pauses after each screenful of information.
/Q Displays file owner.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field to display or use for sorting.
timefield C creation time
A last access time
W last written time
/W Uses wide list format.
/X Displays short names generated for non 8dot3 filenames. The format is that of /N with the short name inserted before the long name. If there is no short name, blanks are displayed in its place.
/4 Uses four-digit year

Switches may be pre-set in the DIRCMD environment variable. To override pre-set switches, prefix with - (hyphen). For example, /-W.
Floor 2 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
cd
Displays the name of the current directory or changes the current directory.

CHDIR
CHDIR
CD
CD

.. Specifies to change to the parent directory.

Typing CD drive: displays the current directory on the specified drive.
Typing CD by itself displays the current drive and directory.

Using the /D command-line switch changes the current drive in addition to changing the current directory of the drive.

If extended command handling is enabled, CHDIR will change as follows:

The current directory string is converted to use the case of the letters on the disk. So, if the case on the disk is like this, CD C:\TEMP will set the current directory to C:\Temp.

The CHDIR command does not treat spaces as delimiters, so it is possible to change the directory name to a subdirectory name with spaces but without quotes. For example:

cd \winnt\profiles\username\programs\start menu

is the same as:

cd "\winnt\profiles\username\programs\start menu"

In the case where extended functionality is disabled, you must type the above command.
Floor 3 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Create directory.

MKDIR path
MD path

If command extensions are enabled, MKDIR will change as follows:

If necessary, MKDIR will create intermediate directories in the path. For example: Suppose \a does not exist, then:

mkdir \a\b\c\d

Is the same as:

mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d

Same. If extensions are disabled, you need to type mkdir \a\b\c\d.
Floor 4 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Delete a directory.

RMDIR path
RD path

/S In addition to the directory itself, all subdirectories and
files under the specified directory will also be deleted. Used to delete the directory tree.

/Q Quiet mode, when deleting the directory tree with /S, no confirmation is required
Floor 5 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Copy one or more files to another location.

COPY source
]

source Specifies the file(s) to copy.
/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allows decrypting the target file to be created
destination Specifies the directory and/or filename for the new file.
/V Verifies that new files are written correctly.
/N When copying a file with a non-8dot3 name, use the short filename
if possible.
/Y Suppresses prompting to confirm rewriting an existing target file.
/-Y Prompts to confirm rewriting an existing target file.
/Z Copies a networked file in restartable mode.

The command-line switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Unless the COPY command
is executed in a batch script, the default is to prompt on overwrite.

To append files, specify a single file for destination and several files for
source (using wildcards or file1+file2+file3 format).
Floor 6 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Display or change file attributes.

ATTRIB filename]
]

+ Set attribute.
- Clear attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.

Specify the file attributes to be processed.
/S Process matching files in the current folder and its subfolders.
/D Also process folders.
Floor 7 Posted 2003-11-27 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Display the folder structure of a drive or path graphically.

TREE

/F Displays the names of the files in each folder.
/A Uses ASCII characters instead of extended characters.
Floor 8 Posted 2003-11-27 00:00 ·  中国 辽宁 抚顺 联通
银牌会员
★★★
论坛候鸟
Credits 1,131
Posts 332
Joined 2003-11-27 00:00
22-year member
UID 13461
Gender Male
Status Offline
Very good
Floor 9 Posted 2003-11-27 00:00 ·  中国 河南 安阳 联通
银牌会员
★★★
Credits 1,186
Posts 334
Joined 2003-05-30 00:00
23-year member
UID 2626
Gender Male
Status Offline
Why can't I find the delete button if the upload was not successful
Floor 10 Posted 2003-11-27 00:00 ·  中国 河南 安阳 联通
银牌会员
★★★
Credits 1,186
Posts 334
Joined 2003-05-30 00:00
23-year member
UID 2626
Gender Male
Status Offline
Quickly Master DOS 6.22Open Attachment
Floor 11 Posted 2003-11-29 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Some Commands I Know

ASSOC Displays or modifies file extension associations.
AT Schedules commands and programs to run on a computer.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
CACLS Displays or modifies the access control lists (ACLs) of files.
CALL Calls one batch program from another.
CD Displays the name of the current directory or changes it.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of the current directory or changes it.
CHKDSK Checks a disk and displays a status report.
CHKNTFS Displays or modifies the boot-time disk check.
CLS Clears the screen.
CMD Opens another Windows command interpreter window.
COLOR Sets the default console foreground and background colors.
COMP Compares the contents of two or more files.
COMPACT Displays or changes the compression of files on NTFS partitions.
CONVERT Converts a FAT volume to NTFS. You cannot convert the current drive.
COPY Copies at least one file to another location.
DATE Displays or sets the date.
DEL Deletes at least one file.
DIR Displays files and subdirectories in a directory.
DISKCOMP Compares the contents of two floppy disks.
DISKCOPY Copies the contents of one floppy disk to another.
DOSKEY Edits command lines, calls Windows commands, and creates macros.
ECHO Displays a message, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE Deletes at least one file.
EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two or more files and displays the differences.
FIND Searches for a text string in a file.
FINDSTR Searches for strings in a file.
FOR Runs a specified command for each file in a set.
FORMAT Formats a disk for use with Windows.
FTYPE Displays or modifies the file type used in file extension associations.
GOTO Directs the Windows command interpreter to a labeled line in a batch program.
GRAFTABL Enables Windows to display an extended character set in graphics mode.
HELP Provides help information for Windows commands.
IF Performs conditional processing in a batch program.
LABEL Creates, changes, or deletes the volume label of a disk.
MD Creates a directory.
MKDIR Creates a directory.
MODE Configures system devices.
MORE Displays one screenful of results at a time.
MOVE Moves a file from one directory to another.
PATH Displays or sets the search path for executable files.
PAUSE Pauses processing of a batch file and displays a message.
POPD Restores the previous value of the current directory saved by PUSHD.
PRINT Prints a text file.
PROMPT Changes the Windows command prompt.
PUSHD Saves the current directory then changes it.
RD Deletes a directory.
RECOVER Recovers readable information from a bad disk.
REM Records comments in a batch file or CONFIG.SYS.
REN Renames a file.
RENAME Renames a file.
REPLACE Replaces files.
RMDIR Deletes a directory.
SET Displays, sets, or removes Windows environment variables.
SETLOCAL Begins localization of environment changes in a batch file.
SHIFT Shifts the position of replaceable parameters in a batch file.
SORT Sorts input.
START Starts another window to run a specified program or command.
SUBST Associates a path with a drive letter.
TIME Displays or sets the system time.
TITLE Sets the window title for a CMD.EXE session.
TREE Displays the directory structure of a drive or path in graphic mode.
TYPE Displays the contents of a text file.
VER Displays the Windows version.
VERIFY Tells Windows whether to verify that files are written correctly to disk.
VOL Displays the disk volume label and serial number.
XCOPY Copies files and directory trees.
Floor 12 Posted 2003-11-29 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
ASSOC Displays or modifies file extension associations Detailed explanation of ASSOC ]]

.ext Specifies the file extension associated with the file type
fileType Specifies the file type associated with the file extension

Type ASSOC without parameters to display current file associations. If you call ASSOC with only a file extension, it displays the current file association for that file extension. If you do not specify any parameters for the file type, the command deletes the association for the file extension.
Floor 13 Posted 2003-11-29 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
The AT command is used to schedule commands and programs to run at specific dates and times.

To use the AT command, the Scheduling Service must be running.

AT | /DELETE ]
AT time
| /NEXT:date] "command"

\\computername Specifies a remote computer. If this parameter is omitted,
the command will be scheduled to run on the local computer.
id Specifies the identification number assigned to a scheduled command.
/delete Deletes a scheduled command. If id is omitted,
all scheduled commands on the computer will be deleted.
/yes Used with the command to delete all jobs when no further confirmation is needed.
time Specifies the time to run the command.
/interactive Allows the job to interact with the desktop of the user who is logged on at the time it runs.
/every:date Runs the command on the specified dates each month or week. If the date is omitted, it defaults to running on the same day of each month.
/next:date Specifies that the command will run on the next specified date (for example, next Thursday). If the date is omitted, it defaults to running on the same day of each month.
"command" The Windows NT command or batch program to be run.
Floor 14 Posted 2003-11-29 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
break
Set or clear the extended CTRL+C detection for the DOS system

This command is retained for compatibility with the DOS system and does not work in Windows XP.

If command extensions are enabled and the operating platform is Windows XP, the BREAK command will enter a hard-coded breakpoint when being debugged by a debugging program.
Floor 15 Posted 2003-11-29 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
cacls
Displays or modifies the access control list (ACL) of a file

CACLS filename ]
] ]
filename Displays the ACL.
/T Changes the ACL of the specified file in the current directory and all its subdirectories.
/E Edits the ACL instead of replacing it.
/C Continues on access-denied errors.
/G user:perm Grants access rights to the specified user.
Perm can be: R Read
W Write
C Change (Write)
F Full control
/R user Revokes the access rights of the specified user (valid only when used with /E).
/P user:perm Replaces the access rights of the specified user.
Perm can be: N None
R Read
W Write
C Change (Write)
F Full control
/D user Denies access to the specified user.
Wildcards can be used in the command to specify multiple files.
Multiple users can also be specified in the command.

Abbreviations:
CI - Container inherit.
ACEs will be inherited by directories.
OI - Object inherit.
ACEs will be inherited by files.
IO - Inherit only.
ACEs do not apply to the current file/directory.
Forum Jump: