Shut down Windows 8 from command line WITHOUT BANNER?

8

6

One can open the command line (cmd) and type

shutdown -s -t 1200 

to shut down Windows 8 in 1200 seconds. However, an ugly banner appears over the whole screen 10 minutes before the shutdown! Is there a way to avoid the banner showing up?

enter image description here

MarkovCh1

Posted 2012-10-18T05:07:47.723

Reputation: 644

1I see no banner when I do this (except the notification in the tray(. Can you take a screen shot? – cutrightjm – 2012-10-18T05:38:01.380

http://imgur.com/AKSMN – MarkovCh1 – 2012-10-19T05:55:01.243

Answers

15

In PowerShell, use:

timeout -t 1800; shutdown -s

Or in cmd, use:

timeout 1800 && shutdown -s

They will cause a delay of 1,800 seconds (30 minutes), then perform the shutdown.

MarkovCh1

Posted 2012-10-18T05:07:47.723

Reputation: 644

2You'll want to use && rather than &. && only executes the right hand side if the left hand side returns an errorlevel of 0 (i.e. successful execution). & will always execute the right hand side. The problem here is that & will execute the right hand side even if you cancel the countdown (with Ctrl + C), which is dangerous. – Bob – 2012-10-27T14:10:23.960

1

You're looking for a "wait" command to add before shutting down, instead of making shutdown do the waiting. According to this question, this should do the trick:

ping -n 1201 127.0.0.1 > nul && shutdown -s

dset0x

Posted 2012-10-18T05:07:47.723

Reputation: 1 897

This doesn't work as written. However, I figured out how to do it anyway. Good idea, I can't believe it hasn't occurred to me that there is a wait command on Windows (I'm used to Linux's shell, and made the bad assumption that Windows can't do anything). – MarkovCh1 – 2012-10-19T05:58:10.273

If you could let me know what the correct syntax is it would be helpful for people who find this question. – dset0x – 2012-10-19T11:12:45.833

I'm not sure. Probably ping -n 1201 127.0.0.1 > nul; shutdown -s But I added an alternative answer below. You can test by using shutdown -s -t 10 in the command, and then immediately typing shutdown -a to abort the shutdown. EDIT: This might have failed for me because I used PowerShell! – MarkovCh1 – 2012-10-19T15:43:03.580

2FYI you don't need to use ping anymore to delay scripts/commands. Windows Vista and later have a built-in timeout command which achieves the same purpose in a less roundabout way. – nhinkle – 2012-10-19T19:14:09.560

1

There is a good utility in Sysinternals (now Microsoft) PSTools called psshutdown. I use it since Windows NT for remote shutdown. It can also do a local shutdown. To be honest, I didn't check the differences between psshutdown and shutdown. I think it's worth a try.

As per the delay, why not use the builtin scheduler? I am not familliar with powershell, but I believe that a script could be written that would get current date, time, add a desired interval ant then create a run once scheduled task to execute a shutdown.

OSLoader

Posted 2012-10-18T05:07:47.723

Reputation: 11