本文介绍了使用呼吁在一个批处理脚本标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用CALL命令来调用批处理脚本标签,你最终的子程序与GOTO:EOF,从那里会发生什么?它返回到那里的子程序的CALL所在?或者它继续进行呼叫脚本的位置后?
When using the CALL command to call a label in a batch script, and you end the sub-routine with GOTO:eof, what happens from there? Does it return back to where the sub-routine's CALL is located? Or does it continue on after the location of the call script?
例如:
ECHO It's for my college fund.
CALL :OMGSUB
ECHO *runs away and cries like a little girl*
:OMGSUB
ECHO Your mom goes to college.
GOTO:eof
ECHO *picks up jewelry box*
GOTO后:EOF,这个线将是下一呼应
After GOTO:eof which line will it echo next?
推荐答案
为什么不运行它,看看自己?我救了你的脚本称为foo.bat一个批处理文件,我改变了你妈妈上大学前有一个回声
。
Why not just run it and see for yourself? I saved your script to a batch file called foo.bat, and I changed the Your mom goes to college to have an echo
in front.
C:\temp>foo
C:\temp>ECHO It's for my college fund.
It's for my college fund.
C:\temp>CALL :OMGSUB
C:\temp>echo Your mom goes to college.
Your mom goes to college.
C:\temp>GOTO:eof
C:\temp>ECHO *runs away and cries like a little girl*
*runs away and cries like a little girl*
C:\temp>echo Your mom goes to college.
Your mom goes to college.
C:\temp>GOTO:eof
C:\temp>
所以很容易地看到,经过了 OMGSUB
被调用,它
- 转到文件的末尾。
- 然后返回到线对AFER的
CALL:OMGSUB
和回声的逃跑行 - 然后再它的回声您妈妈行
- 将它转到文件结尾并终止的
- 回声的拿起jewewlry箱的线永远不会被达到。
- Goes to the end of file.
- Then it returns to the line right afer the
CALL :OMGSUB
and echos the "runs away" line - Then it echos the Your Mom line again
- The it goes to end of file and terminates
- The echo picks up jewewlry box line never gets reached.
这篇关于使用呼吁在一个批处理脚本标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!