0

正如标题所说,shutdown /s /t xx当我从脚本运行典型命令时,它不起作用。它不会在几秒钟后关闭x,而是只运行该shutdown部分,并忽略参数。但是,如果我在命令提示符窗口中手动键入它,它会正确执行。我尝试从类似的脚本运行其他命令,ipconfig /all但没有问题。这是一般的 Windows 10 问题还是我的计算机上出现了问题?

PS 我也得到了与 Powershell 相同的结果。

4

4 回答 4

5

将此作为诊断步骤进行测试。

@echo off
"c:\Windows\System32\shutdown.exe" /s /t 20
pause
于 2015-08-27T17:14:29.897 回答
3

换掉我们的/s /t xxfor -s -t xx。这在我的 Windows 10 系统上解决了这个问题。

于 2015-08-26T21:57:00.963 回答
1

Might be worth mentioning Powershell doesn't always play nice with external executables and command line switches/arguments. Try using:

Start-Process shutdown.exe -ArgumentList "/s /t 20"

Also, there is Invoke-Item which can start a process but I've noticed using Start-Process

Reference this for more information.

于 2015-08-28T04:40:52.207 回答
0

在 PowerShell 中,您可以使用Stop-Computer.

于 2015-08-26T23:03:39.770 回答