Avoid "system will shut down in 10 minutes" using shutdown on windows
As an alternative, you could use an external timer and a force shutdown at the correct time. For example:
timeout -t 3600 -nobreak && shutdown -s -t 00
Note that a caveat of this approach is that the shutdown
command is not actually send (e.g. to networked computers) until the timeout
is finished, therefore you will need the sending computer to be on with a working connection at the end of the timeout
. A workaround is to run the entire command directly on the target computer, e.g. with PsExec.
If you want to hide the command window as well, there are many ways to do so.
I personally favour a PowerShell-based command that hides itself (run from a cmd
window in this case):
start powershell.exe -WindowStyle Hidden -Command "sleep 3600; shutdown -s -t 00"
PowerShell can be configured for remoting, too. And it might be preferable to use the native Stop-Computer
command rather than shutdown
.
You can easily do that by changing the comment to space:
shutdown -s -t 3600 -c " "
The warning message will be skipped because there is no message.