带输入提示的远程计算机批处理脚本
问题描述:
我正在尝试编写一个批处理脚本,用于关闭远程计算机并提示输入计算机名称。我试图复制位,我发现脚本块,但到目前为止没有将工作带输入提示的远程计算机批处理脚本
这是我到目前为止有:
@ECHO OFF
set /p computer =Enter computer Name:
shutdown -m %computer% -r -t 60
答
这个脚本应该工作。请注意,我已删除computer
和=Enter computer name
@ECHO OFF
:InputComputerName
set /p computer=Enter computer Name:
IF "%computer%"=="" GOTO Error
echo Shutting down %computer%
shutdown -s -m \\%computer% -t 600 -c "The computer is shutting down. Please save your work."
GOTO End
:Error
ECHO You did not enter a computer name
GOTO :InputComputerName
:End
+0
谢谢你,完美的作品 –
在设置命令之间的空间,去掉变量名(计算机)和等号之间的空间。 – ooga