Board logo

标题: 請幫忙分析謝謝 [打印本页]

作者: w909525     时间: 2007-4-17 10:38    标题: 請幫忙分析謝謝

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這個程序,請幫忙分析一下我錯在哪裡,謝謝

具體批處理請看附件。
作者: lxmxn     时间: 2007-4-19 10:38
你的search.exe是个外部命令?
作者: lxmxn     时间: 2007-4-19 10:39
为什么不用find、findstr呢?
作者: htysm     时间: 2007-4-19 22:55
楼主你发了重复帖了。
作者: paulhybryant     时间: 2007-4-21 05:12
关注
作者: tsenix     时间: 2007-4-21 13:41
errorlevel 是指错误代码大过或等于...
所以如果, 1是指"找到"的话, 应该写成:

search.exe feature.ini "FP=FP"
if errorlevel 1 goto next
goto end