【问题标题】:Remote computer batch script with input prompt带有输入提示的远程计算机批处理脚本
【发布时间】:2015-04-22 23:58:09
【问题描述】:

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

这是我目前所拥有的:

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

【问题讨论】:

  • 在set命令中,去掉变量名(计算机)和等号之间的空格。

标签: batch-file shutdown


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 2020-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-22
    相关资源
    最近更新 更多