goto :eof 其实是相当于Continue的效果,跳转到结尾。
你测试如下代码,就知道如何return call了- call :aa &&echo aa is true! || echo aa is false!
- call :bb &&echo bb is true! || echo bb is false!
- pause&exit
-
- :aa
- exit /b 0
- echo not retrun aa!
- goto :eof
-
- :bb
- exit /b 1
- echo not retrun bb!
复制代码 那么试试下面的- @echo off&setlocal enabledelayedexpansion
- for /l %%i in (1,1,3) do call :loop && echo ok! || echo 3次检查中不存在2的倍数。
- pause&goto :eof
-
- :loop
- for /l %%a in (1,1,3) do (
- echo %%a
- set /a r=%%a%%2
- if !r! equ 0 exit /b 0
- )
- exit /b 1
复制代码
[ 本帖最后由 caruko 于 2010-7-28 01:20 编辑 ] |