Is it possible to avoid the message that displays that the system will shut down in ten minutes if using the following command?
shutdown -s -t 3600
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityYou 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.
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
.
timeout
was just an example of the concept of using an external timer; there are many other ways of doing so, some less obtrusive.
shutdown
command not being sent until the timeout
expires is still there, but PsExec is a workaround. It's still not as robust as shutdown
, which (I believe) sets a scheduled task or similar, while this process can still be ended. A more robust solution may be to calculate the actual shutdown time and add a scheduled task, which can be done within the command-line with the at
command.
You will have to turn off the automatic logoff command task..
Windows -> Start -> Run -> shutdown -a
Start Menu -> Search "Task Scheduler"
Action -> Create Basic Task
Choose the time and frequency for which you want the event to occur.
Once you get to the Action section, select "Start a Program" and choose:
"C:\Windows\System32\shutdown.exe"
and give the appropriate parameters for the arguments:
/s /f /t 0
These argmuments break down as follows: /s shutdown /f force the shutdown /t 0 t for time, 0 seconds
Click finish and you're good to go.
Add the -p
flag to avoid the "System will shutdown in 10 minutes" message.
shutdown -p -s -t 3600
If you want to cancel the shutdown, use this command, use shutdown -a
. If you just want to hide the notification:
shutdown -s -t 3600
.Shutdown tooltips won't appear on that computer anymore and the icon will be hidden.