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-07-02 13:21
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » What does "goto :eof" mean? View 2,186 Replies 15
Original Poster Posted 2007-08-04 20:53 ·  中国 广东 梅州 电信
中级用户
★★
Credits 262
Posts 129
Joined 2007-07-11 06:50
18-year member
UID 93679
Gender Male
Status Offline
What does "goto :eof" mean?
Floor 2 Posted 2007-08-04 20:56 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
end of file?
To the end... That is, exit
Floor 3 Posted 2007-08-04 21:30 ·  中国 湖南 株洲 电信
新手上路
Credits 16
Posts 7
Joined 2007-08-03 22:29
18-year member
UID 94605
Gender Male
Status Offline
In batch processing, `goto :s` means to jump to the line marked with `:s`, and specifically it depends on the commands to be executed next.
Floor 4 Posted 2007-08-04 21:43 ·  中国 香港 腾讯云
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
goto :eof is slightly different from ordinary jumps.

In goto :eof, the : must be added, while in ordinary jumps, the : sign can be omitted.

goto :eof does not need a label on a certain line, while ordinary jumps must have a label.

For example: Upstairs, a label must be set on a certain line. Such as :s.

[ Last edited by wudixin96 on 2007-8-4 at 09:48 PM ]
Floor 5 Posted 2007-08-04 22:24 ·  中国 湖南 株洲 电信
新手上路
Credits 16
Posts 7
Joined 2007-08-03 22:29
18-year member
UID 94605
Gender Male
Status Offline
Hehe, learned something new again, thanks to the person above!
Floor 6 Posted 2007-08-05 07:30 ·  中国 广东 梅州 电信
中级用户
★★
Credits 262
Posts 129
Joined 2007-07-11 06:50
18-year member
UID 93679
Gender Male
Status Offline
What does `goto :eof` mean? If you want to exit, why not just use `exit`?
Floor 7 Posted 2007-08-05 14:13 ·  中国 广西 钦州 灵山县 电信
初级用户
Credits 75
Posts 36
Joined 2007-05-11 10:12
19-year member
UID 88144
Gender Male
Status Offline
I don't understand this very much. Can you be more detailed?
Floor 8 Posted 2007-08-06 10:02 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Where to come from and where to go. Personal understanding.

For example:
call :XXXXXX
1234
:XXXXXX
XXX
goto :eof
After calling, it directly returns to the place of call :XXXXXX and continues to execute downward. (I haven't used it.. so..)
Floor 9 Posted 2007-08-06 23:51 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
Originally posted by kidzgy at 2007-8-5 07:30 AM:
What does goto :eof mean? If you want to exit, why not just use exit?


You're thinking too simply. goto :eof isn't about exiting.
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 10 Posted 2007-08-07 05:10 ·  中国 四川 泸州 电信
初级用户
Credits 54
Posts 27
Joined 2006-12-02 11:46
19-year member
UID 72370
Gender Male
Status Offline
Can you give an example? Just asking because I don't understand
Floor 11 Posted 2007-08-07 10:26 ·  中国 广东 梅州 电信
中级用户
★★
Credits 262
Posts 129
Joined 2007-07-11 06:50
18-year member
UID 93679
Gender Male
Status Offline
Then what does `goto :eof` exactly mean?
Floor 12 Posted 2007-08-07 21:53 ·  中国 宁夏 银川 电信
初级用户
Credits 89
Posts 40
Joined 2007-05-13 11:15
19-year member
UID 88380
Gender Male
Status Offline
goto eof is used in batch script writing, and exit is a command directly in the DOS interface...
Never stop!!!
Love DOS !Love Computer!
Floor 13 Posted 2009-05-25 04:15 ·  中国 福建 泉州 电信
新手上路
Credits 14
Posts 4
Joined 2009-05-21 07:40
17-year member
UID 145609
Gender Male
Status Offline
Floor 14 Posted 2009-05-25 04:47 ·  中国 河北 唐山 电信
初级用户
★★
Credits 85
Posts 52
Joined 2009-01-10 18:22
17-year member
UID 136322
Gender Male
From 湘乡
Status Offline
The above one:
@set c= I don't know then I feel more, I know then I feel less, the more I know the more, then I feel less and less. --- Knowing more and less.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul
It's so amazing, can you explain it?
Floor 15 Posted 2009-05-25 12:21 ·  中国 吉林 延边朝鲜族自治州 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
In general batch processing, there is not an obvious difference between goto :eof and exit, but when calling multiple labels, the difference can be seen. As follows:
@echo off
for /l %%i in (1,1,3) do call :%%i
pause
exit
:1
echo 1
pause
goto :eof
:2
echo 2
pause
goto :eof
:3
echo 3
pause
goto :eof
:The last goto :eof can be omitted
Forum Jump: