我有一个脚本可以在 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."