我有个在用的自动关闭几台电脑的批处理,你可以借鉴下,不过你先要确定自己是不是有权限远程关闭电脑:
@echo off&color 97&mode con lines=15
ping 134.163.144.75 -n 1 >nul
if errorlevel=1 goto 2
if errorlevel=0 goto select1
:1
echo.&echo.&echo.
set /p t= 请输入你要延时的秒数(直接回车默认为60秒):
if "%t1%"=="" goto close
set t=%t1%
shutdown -s -m \\134.163.144.75 -t %t% -f
goto 11
:close
shutdown -s -m \\134.163.144.75 -t 60 -f
:11
echo.&echo.&echo.
cls
echo ******===================================================******
echo 75电脑已经成功关闭
echo ******===================================================******
pause
:2
cls
ping 134.163.144.71 -n 1 >nul
if errorlevel=1 goto select3
if errorlevel=0 goto select2
:3
echo.&echo.&echo.
cls
set /p t= 请输入你要延时的秒数(直接回车默认为60秒):
if "%t2%"=="" goto close2
set t=%t2%
shutdown -s -m \\134.163.144.71 -t %t% -f
goto 21
:close2
shutdown -s -m \\134.163.144.71 -t 60 -f
:21
echo.&echo.&echo.
cls
echo ******===================================================******
echo 71电脑已经成功关闭
echo ******===================================================******
pause
goto select3
:4
echo.&echo.&echo.
set /p t= 请输入你要延时的秒数(直接回车默认为60秒):
if "%t3%"=="" goto close3
set t=%t3%
shutdown -s -t %t% -f
:close3
shutdown -s -t 60 -f
goto :eof
:select1
cls
echo.&echo.&echo.
set/p select1= 是否确认关闭75?(1.关闭 2.不关闭):
if "%select1%"=="1" goto 1
if "%select1%"=="2" goto 2
cls
echo.&echo.&echo.
echo 输入错误!
ping /n 2 127.1 >nul
goto select1
:select2
cls
echo.&echo.&echo.
set/p select2= 是否确认关闭71?(1.关闭 2.不关闭):
if "%select2%"=="1" goto 3
if "%select2%"=="2" goto select3
cls
echo.&echo.&echo.
echo 输入错误!
ping /n 2 127.1 >nul
goto select2
:select3
cls
echo.&echo.&echo.
set/p select3= 是否确认关闭本机?(1.关闭 2.不关闭):
if "%select3%"=="1" goto 4
if "%select3%"=="2" goto :eof
cls
echo.&echo.&echo.
echo 输入错误!
ping /n 2 127.1 >nul
goto select3
Last edited by zw19750516 on 2008-3-18 at 05:17 PM ]