我有一個腳本,它可以在Windows 7上工作,但不會在2k8上拋出未找到的文件異常。蝙蝠腳本工作在Windows 7上,但不是在窗口上2k8
@echo off
REM #Testing FIND in IPCONFIG
SET VIPTHATWORKS="11.11.11.11"
SET VIPTHATFAILS="192.168.122.17"
ipconfig /all | find %VIPTHATWORKS%
if ERRORLEVEL = 1 goto VIP_NOT_FOUND
REM #We are here becuase the find returned a result.
REM #It is safe to execute the rest of the application.
REM #EXECUTES THE SCRIPT HERE
echo "testing works" >> testing.txt
:VIP_NOT_FOUND
REM #This part of the script is where you would handle any
REM #error logging or other admin related
echo "Could not find a VIP. - Exiting"
echo "end of script reached."
這只是一種預感,也許'IPCONFIG'信息是從win7的一個文件,這在2K8缺少閱讀。否則,我看不到你的腳本可能訪問文件的其他地方。 –