中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 02:23
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Batch file experts, please come in!
Printable Version  570 / 3
Floor1 drlzf Posted 2003-12-11 00:00
初级用户 Posts 14 Credits 158
Thanks to willsort for the detailed answer!
Thanks!
Floor2 drlzf Posted 2003-12-21 00:00
初级用户 Posts 14 Credits 158
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.
Floor3 电吉入侵 Posted 2003-12-23 00:00
初级用户 Posts 377 Credits 1,480
It seems this can't be called in a batch file like that, you can only put the whole aa section into a.bat /
Floor4 willsort Posted 2003-12-24 00:00
元老会员 Posts 1,512 Credits 4,432
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
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023