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 01:26
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Batch file experts, please come in! View 567 Replies 3
Original Poster Posted 2003-12-11 00:00 ·  中国 广东 佛山 三水区 电信
初级用户
爱之屋论坛管理员
Credits 158
Posts 14
Joined 2003-12-17 00:00
22-year member
UID 14122
Gender Male
Status Offline
Thanks to willsort for the detailed answer!
Thanks!
Floor 2 Posted 2003-12-21 00:00 ·  中国 广东 佛山 三水区 电信
初级用户
爱之屋论坛管理员
Credits 158
Posts 14
Joined 2003-12-17 00:00
22-year member
UID 14122
Gender Male
Status Offline
Can any batch file experts write up some batch commands for us to learn from?
For example, if I want to call the aa section in b.bat from a.bat (b.bat:aa), how can that be done, and so on.
Floor 3 Posted 2003-12-23 00:00 ·  中国 广东 广州 荔湾区 电信
初级用户
★★★
Credits 1,480
Posts 377
Joined 2003-06-06 00:00
23-year member
UID 3875
Gender Male
Status Offline
It seems this can't be called in a batch file like that, you can only put the whole aa section into a.bat /
欢迎大家访问我的主页!
精品.爱好http://iso.533.net
Floor 4 Posted 2003-12-24 00:00 ·  中国 山东 烟台 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re drlzf:

This can be done by using command-line parameters, as follows:

::a.bat
call b $block block1
rem b is the batch command name
rem $block is the marker for calling a certain section; it can be replaced with any other intentional string
rem block1 is the name of the section to call



::b.bat
@echo off
if == goto %2
rem if parameter 1 is the section-call marker, then jump to the section specified by parameter 2

:block1
rem contents of section 1
goto end

:block2
rem contents of section 2
goto end

:block3
rem contents of section 3
goto end

:end
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: