标题: find命令在查找文件中特定字符串中的应用
[打印本页]
作者: qdcr
时间: 2006-6-28 14:38
标题: find命令在查找文件中特定字符串中的应用
@echo off
find "worldcup" e:\files\test.txt
if ERRORLEVEL 1 echo String "worldcup" has already existed in file "e:\files\test.txt"
pause
test.txt内容为:
worldcup
Euro Championship
Aisa Championship
在test.txt中存在的worldcup,为什么用上诉批处理,不能输出 存在提示呢?
作者: 不得不爱
时间: 2006-6-28 18:32
@echo off
find "worldcup" e:\files\test.txt>nul
if ERRORLEVEL 0 echo String "worldcup" has already existed in file "e:\files\test.txt"
pause
作者: namejm
时间: 2006-7-1 09:24
楼主对错误码的理解有问题,如果错误码为1,一般是表示执行失败。