我目前已经做到了,但是 for 循环中有一个意外错误。
请帮忙。
@ECHO OFF
COLOR 1F
TITLE (Ash's Script) Server Ping Pong
rem ---------------------------------------------------------------------------------------------------------------
ECHO Started %time% %date% > X:\Scripts\ServerPing.txt
rem ---------------------------------------------------------------------------------------------------------------
FOR /f "tokens=*" %%i in (X:\Scripts\ComputerLists\ServerList.csv) DO (
PING %%i -n 1 -w 3
IF ERRORLEVEL 0 (
ECHO %%i ONLINE %time%>> X:\Scripts\ServerPing.txt
) ELSE (
ECHO %%i OFFLINE %time%>> X:\scripts\ServerPing.txt
)
)
rem ---------------------------------------------------------------------------------------------------------------