中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-04 05:43
48,038 主题排行 / 350,123 发帖 / 今日 0 篇 / 48,251 会员排行
DOS批处理 & 脚本技术(批处理室) » 問個問題,請了解的幫忙分析一下,謝謝
可打印版本  726 / 3
第1楼 w909525 发表于 2007-04-17 10:36
初级用户 发帖 34 积分 98
問個問題,請了解的幫忙分析一下,謝謝
if exist d:\pass.txt goto end

if exist c:\feature.ini goto test

goto end

:pass
d:
cd\
md pass.txt

goto end

:test
c:
cd\
search.exe feature.ini "FP=FP"
if errorlevel 0 if errorlevel 1 goto next(這裡不論我的返回嗎怎么設都會到next,請幫忙分析)
goto end

:next
pause
c:
cd\
c:\times.exe

c:\search times.txt "3 times"
if errorlevel 0 if not errorlevel 1 goto pass
PAUSE
c:
cd\
cd Users\test\Desktop\Gmouse
call Gmouse.exe c.gms

:end
pause
exit

我的本意是當有feature.ini 這個檔時就search 看裡面有沒有FP=FP這個字符串,如果有就執行gmouse這個程序,如果沒有就結束,但是在search時卻出現不返回碼不論我設為0還是1都會執行gmouse這個程序,請幫忙分析一下我錯在哪裡,謝謝
第2楼 flyinspace 发表于 2007-04-17 11:19
银牌会员 发帖 517 积分 1,206
if errorlevel 0 if errorlevel 1 goto next(這裡不論我的返回嗎怎么設都會到next,請幫忙分析)

就是这句有问题啊.

改为 if not errorlevel 1 goto next
第3楼 flyinspace 发表于 2007-04-17 11:26
银牌会员 发帖 517 积分 1,206
search.exe feature.ini "FP=FP"

findstr "FP=FP" feature.ini
if not errorleve 1 goto :^
第4楼 htysm 发表于 2007-04-18 05:32
高级用户 发帖 415 积分 866
search.exe feature.ini "FP=FP"
if errorlevel 0 if errorlevel 1 goto next(這裡不論我的返回嗎怎么設都會到next,請幫忙分析)
goto end

:next
-----------------------------------------------------------------------------
findstr /i "FP=FP" feature.ini && echo 成功 || echo 失败
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023