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 03:19
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Explanation of DOS Commands (I'm also a novice) View 2,467 Replies 29
Floor 16 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
Calling another batch program from a batch program.

CALL filename

batch-parameters Specifies command-line information needed by the batch program.

If command extensions are enabled, CALL changes as follows:

The CALL command now accepts labels as targets for CALL. The syntax is:

CALL:label arguments

A new batch file context is created with the specified arguments, and control is passed to the statement after the label is specified. You must "exit" twice by reaching the end of the batch script twice. The first time the end of the file is read, control returns to immediately after the CALL statement. The second time exits the batch script. Type GOTO /? to see the description of the GOTO : EOF extension, which allows you to return from a batch script.

In addition, batch script text parameter references (%0, %1, etc.) have changed as follows:


%* in a batch script indicates all parameters (such as %1 %2 %3 %4 %5 ...)

Substitution of batch parameters (%n) has been enhanced. You can use the following syntax:

%~1 - Remove quotes (" and expand %1
%~f1 - Expand %1 to a fully qualified pathname
%~d1 - Expand %1 to just a drive letter
%~p1 - Expand %1 to just a path
%~n1 - Expand %1 to just a filename
%~x1 - Expand %1 to just a file extension
%~s1 - Expanded path contains short names
%~a1 - Expand %1 to file attributes
%~t1 - Expand %1 to file date/time
%~z1 - Expand %1 to file size
%~$PATH:1 - Search directories listed in the PATH environment variable and expand %1 to the first fully qualified name found. If the environment variable name is not defined or the file is not found, this combination expands to an empty string

You can combine modifiers to get multiple results:

%~dp1 - Expand %1 to just drive letter and path
%~nx1 - Expand %1 to just filename and extension
%~dp$PATH:1 - Search directories listed in the PATH environment variable for %1 and expand to the drive letter and path of the first file found.
%~ftza1 - Expand %1 to a DIR-like output line.

In the above examples, %1 and PATH can be replaced with other valid values. The %~ syntax is terminated by a valid parameter number. %~ modifiers cannot be used with %*
Floor 17 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
Displays or sets the active code page number.

CHCP

nnn Specifies the code page number.

Typing CHCP without a parameter displays the active code page number
Floor 18 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
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 without parameters displays the current drive and directory.

Using the /D command-line switch, in addition to changing the current directory of the drive,
it can also change the current drive.

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

The current directory string will be converted to use the case on the disk name. 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"

When the extended function is disabled, you must type the above command.
Floor 19 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
Display or modify disk checks at startup.

CHKNTFS volume
CHKNTFS /D
CHKNTFS /T\r\nCHKNTFS /X volume
CHKNTFS /C volume

volume: Specifies a drive (followed by a colon), mount point,
or volume name.
/D Restores the computer to the default state, checks all
drives at startup, and runs chkdsk on drives with issues.
/T:time Changes the AUTOCHK initial countdown time to the specified
amount in seconds. If no time is specified, displays the current setting.
/X Excludes drives that are not checked at startup. Drives excluded
in the last execution of this command are invalid at this time.
/C Schedules checking of drives at startup, and runs chkdsk if the drive has issues.

If no command-line switches are specified, CHKNTFS displays the status of the problem bits for each drive.
Floor 20 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
COMP ]

data1 Specifies the location and name of the first file to compare.
data2 Specifies the location and name of the second file to compare.
/D Displays differences in decimal format.
/A Displays differences using ASCII characters.
/L Displays the number of different lines.
/N=number Compares only the first specified number of lines in each file.
/C Compares files without distinguishing between uppercase and lowercase ASCII letters.
/OFF Does not skip files with the offline attribute set.

To compare a set of files, use wildcards in the data1 and data2 parameters.
Floor 21 Posted 2003-12-04 00:00 ·  中国 湖南 长沙 电信
初级用户
Credits 166
Posts 17
Joined 2003-12-04 00:00
22-year member
UID 13759
Gender Male
Status Offline
A:\赤月1127>RD E:\Qq2003\10221811 /S /Q
Invalid switch - /S

The text you provided is already in English. So the output remains the same:

A:\赤月1127>RD E:\Qq2003\10221811 /S /Q
Invalid switch - /S
Floor 22 Posted 2003-12-04 00:00 ·  中国 湖南 长沙 电信
初级用户
Credits 166
Posts 17
Joined 2003-12-04 00:00
22-year member
UID 13759
Gender Male
Status Offline
Thanks
Floor 23 Posted 2003-12-05 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Display the contents of a text file.

TYPE filename
Floor 24 Posted 2003-12-05 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Search for a string in a file.

FIND ] "string" filename]

/V Display all lines that do NOT contain the specified string.
/C Display only the count of lines that contain the string.
/N Display line numbers.
/I Ignore case when searching for the string.
/OFF Do not skip files with offline attribute set.
"string" Specifies the text string to search for.
filename
Specifies the file(s) to search.

If no path is specified, FIND searches the text typed in or generated by another command.
Floor 25 Posted 2003-12-05 00:00 ·  中国 北京 朝阳区 联通
初级用户
Credits 236
Posts 28
Joined 2003-11-13 00:00
22-year member
UID 12760
Gender Male
Status Offline
Set default console foreground and background colors.

COLOR

attr Specifies the color attributes of console output

The color attribute is specified by two hexadecimal digits -- the first
is the background, the second is the foreground. Each digit can be one of the
following values:

0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

If no argument is given, the command resets the color to what it was when
CMD.EXE started. This value is either from the current console window, the
/T switch, or the DefaultColor registry value.

If the COLOR command is executed with the same foreground and background
colors, the COLOR command sets the ERRORLEVEL to 1.

For example: "COLOR fc" produces bright red on bright white
Floor 26 Posted 2003-12-25 00:00 ·  中国 香港 国际航空电讯集团公司(SITA)
初级用户
Credits 109
Posts 2
Joined 2003-09-21 00:00
22-year member
UID 10137
Gender Male
Status Offline
Thanks
Floor 27 Posted 2003-12-26 00:00 ·  中国 山西 太原 联通
初级用户
Credits 105
Posts 1
Joined 2003-12-26 00:00
22-year member
UID 14500
Gender Male
Status Offline
You can also refer to "Hongen Online - DOS".
Floor 28 Posted 2003-12-28 00:00 ·  中国 河北 张家口 移动
初级用户
Credits 105
Posts 1
Joined 2003-12-28 00:00
22-year member
UID 14577
Gender Male
Status Offline
The "Quick Mastery of DOS 6.22" by Long Wang is really good.
Floor 29 Posted 2003-12-28 00:00 ·  中国 新疆 乌鲁木齐 中移铁通
初级用户
Credits 118
Posts 5
Joined 2003-12-10 00:00
22-year member
UID 14432
Gender Male
Status Offline
It is pretty good
Floor 30 Posted 2003-12-30 00:00 ·  中国 广东 广州 白云区 电信
初级用户
Credits 112
Posts 3
Joined 2003-12-29 00:00
22-year member
UID 14634
Gender Male
Status Offline
Internet fees are expensive~~~~~Can you organize it?~~~`~~It would be even better if it could be packed and taken away~~`
Forum Jump: