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-12 00:51
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Run three batch files together? View 1,025 Replies 2
Original Poster Posted 2010-09-15 17:28 ·  中国 浙江 温州 乐清市 电信
新手上路
Credits 4
Posts 4
Joined 2010-09-06 15:17
15-year member
UID 173702
Gender Male
Status Offline
Right now there are three .bat files in the root of d: . The order I need is to run 001.bat first, then 002.bat, and finally 003.bat.
I want to write another batch file to achieve this effect. How should I write it in the batch file... or just tell me what statement I should use
Floor 2 Posted 2010-09-15 18:08 ·  中国 辽宁 葫芦岛 联通
中级用户
★★
Credits 247
Posts 147
Joined 2009-04-09 20:52
17-year member
UID 142531
Gender Male
Status Offline
Use call
Floor 3 Posted 2010-09-18 11:27 ·  中国 上海 移动
新手上路
Credits 8
Posts 8
Joined 2010-09-15 21:20
15-year member
UID 174259
Gender Male
From 上海
Status Offline
winkey+R
cmd
the call command



Help for the call command:
Calls one batch program from another batch program.
CALL filename
batch-parameters Specifies the command-line information required by the batch program.
If command extensions are enabled, CALL changes as follows:
The CALL command now accepts labels as the target of CALL. The syntax is:
CALL:label arguments
A new batch file context is created by the specified arguments, and control is passed to the statement after the specified label. You must "exit" twice by reaching the end of the batch script file twice. The first time the end of file is read, control will return to the line right after the CALL statement. The second time will exit 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 parameter references (%0, %1, etc.) have been changed as follows:
%* in a batch script indicates all the parameters (such as %1 %2 %3 %4 %5 ...)

Substitution of batch parameters (%n) has been enhanced. You can use the following syntax:
%~1 - removes any surrounding quotes("), expanding %1
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - the expanded path contains short names only
%~a1 - expands %1 to file attributes
%~t1 - expands %1 to the file date/time
%~z1 - expands %1 to the file size
%~$PATH : 1 - searches the directories listed in the PATH environment variable, and expands %1
to the first fully qualified name found. If the environment
variable name is not defined, or the file is not found, this key combination will
expand to an empty string
Modifiers can be combined to get multiple results:
%~dp1 - expands %1 to the drive letter and path only
%~nx1 - expands %1 to the file name and extension only
%~dp$PATH:1 - searches for %1 in the directories listed in the PATH environment variable,
and expands to the drive letter and path of the first file found.
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 %*.

[ Last edited by 676939481 on 2010-9-18 at 11:30 ]
Forum Jump: