Board logo

标题: 問個問題,請了解的幫忙分析一下,謝謝 [打印本页]

作者: w909525     时间: 2007-4-17 10:36    标题: 問個問題,請了解的幫忙分析一下,謝謝
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這個程序,請幫忙分析一下我錯在哪裡,謝謝

作者: flyinspace     时间: 2007-4-17 11:19
if errorlevel 0 if errorlevel 1 goto next(這裡不論我的返回嗎怎么設都會到next,請幫忙分析)

就是这句有问题啊.

改为 if not errorlevel 1 goto next

作者: flyinspace     时间: 2007-4-17 11:26
search.exe feature.ini "FP=FP"

findstr "FP=FP" feature.ini
if not errorleve 1 goto :^

作者: htysm     时间: 2007-4-18 05:32
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 失败