有两个for循环,想跳出内层的返回到外层的for循环,应该怎么办?
不知dos有类似break,continue之类的语句么?
具体代码:
@echo off
for /f "delims=" %%i in (1.txt) do call :ss %%i
:ss
set a=%1
setlocal ENABLEDELAYEDEXPANSION
for /f "delims=" %%j in (2.txt) do (
set b=%%j
if !a! NEQ !b! echo %%j>new.txt
在此处加入退出内层for循环的语句
)
多谢!作者: everest79 时间: 2007-4-27 01:18 for /f "delims=" %%i in (1.txt) do (
for /f "delims=" %%j in (2.txt) do (
if "%%i" == "%%j" echo %%j>new.txt&&goto :eof
)
)
好像这样可以,不过类似这样的查询,用findstr /G:1.txt 2.txt>>new.txt更方便一点作者: zzfer 时间: 2007-4-29 06:25 标题: Thanks
多谢作者: lxmxn 时间: 2007-4-29 09:14
Quote:
Originally posted by everest79 at 2007-4-26 12:18:
for /f "delims=" %%i in (1.txt) do (
for /f "delims=" %%j in (2.txt) do (
if "%%i" == "%%j" echo %%j>new.txt&&goto :eof
)
)
好像这样可以 ...
@echo off
for /l %%i in (1,1,5) do call :doit %%i
pause
eixt
:doit
for /l %%a in (6,1,10) do (
if "%%a"=="9" goto :eof
echo %1 %%a
)
goto :eof作者: dikex 时间: 2007-4-29 09:33 发多一个简单的例子,其他的可以在上面扩展
@echo off
for /l %%a in (6,1,10) do (
if "%%a"=="9" goto :end
echo %1 %%a
)
:end
pause
exit作者: zzfer 时间: 2007-5-1 22:55 标题: 谢谢大家