中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-04 06:45
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 問個問題,請了解的幫忙分析一下,謝謝 查看 727 回复 3
楼 主 問個問題,請了解的幫忙分析一下,謝謝 发表于 2007-04-17 10:36 ·  中国 江苏 苏州 联通
初级用户
积分 98
发帖 34
注册 2007-03-09 08:18
19年会员
UID 81178
性别 男
状态 离线
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 发表于 2007-04-17 11:19 ·  中国 广东 广州 海珠区 电信
银牌会员
★★★
积分 1,206
发帖 517
注册 2007-03-25 01:18
19年会员
UID 82819
性别 男
状态 离线
if errorlevel 0 if errorlevel 1 goto next(這裡不論我的返回嗎怎么設都會到next,請幫忙分析)

就是这句有问题啊.

改为 if not errorlevel 1 goto next
知,不觉多。不知,乃求知
3 发表于 2007-04-17 11:26 ·  中国 广东 广州 海珠区 电信
银牌会员
★★★
积分 1,206
发帖 517
注册 2007-03-25 01:18
19年会员
UID 82819
性别 男
状态 离线
search.exe feature.ini "FP=FP"

findstr "FP=FP" feature.ini
if not errorleve 1 goto :^
知,不觉多。不知,乃求知
4 发表于 2007-04-18 05:32 ·  中国 安徽 芜湖 电信
高级用户
★★★
积分 866
发帖 415
注册 2005-12-04 11:19
20年会员
UID 46459
状态 离线
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 失败
论坛跳转: