带输入提示的远程计算机批处理脚本

时间:2015-04-22 23:58:09

标签: batch-file shutdown

我正在尝试编写一个关闭远程计算机并提示输入计算机名称的批处理脚本。我已经尝试过复制我发现的一些脚本,但到目前为止还没有任何工作

这是我到目前为止所做的:

 @ECHO OFF
 set /p computer =Enter computer Name:
 shutdown -m %computer% -r -t 60

1 个答案:

答案 0 :(得分:1)

此脚本应该有效。请注意,我删除了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
相关问题