PSToos工具使用前提及命令参考
https://blog.csdn.net/hongkaihua1987/article/details/85230082
https://blog.csdn.net/hongkaihua1987/article/details/85230665
https://blog.csdn.net/hongkaihua1987/article/details/85230694
代码: 批处理文件放到PSTools工具目录下
CD .>IP_JZ.bat
FOR /L %%i IN (11,1,81) Do (
for /f "tokens=3 delims=: " %%a in ('ping 10.236.23.%%i -w 600 -n 1 ^|find /i "ttl"') do (
echo psshutdown -t 30 -f -m "要关机了,请保存文件" -u administrator -p 10016 \\%%a >>IP_JZ.bat
)
)
call IP_JZ.bat
使用下面方法提示网络上有重名,需要将局域网内主机名称改成唯一的识别名字,较为麻烦
::psshutdown -t 30 -f -m "要关机了,请保存文件" -u administrator -p huayuan2008 @IP.txt