好的.我找到了一种方法将.bat文件中的shutdown命令转换为即时消息,因为在我工作的地方没有允许的即时消息:
shutdown -s -m \\[computer name] -t 20 -c "[message]"
PING 127.0.0.1 -n 6
shutdown -a -m \\[computer name]
Run Code Online (Sandbox Code Playgroud)
这工作正常,5秒后中止关闭命令,但您必须使用文本编辑器手动编辑计算机名称和消息,然后重新启动程序以发送另一条消息.我想要一种方法来使用SET命令获取用户输入,该命令将计算机名称和消息作为输入.我试过这个,但它不起作用:
:Jump
set /P computer ="Enter the computer name: "
set /P message ="Enter the message: "
shutdown -s -m %computer% -t 20 -c "%message%"
PING 127.0.0.1 -n 6
shutdown -a -m %computer%
GOTO Jump
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?