How to try normal shutdown and then force a shutdown?

1

0

Is there a command for Windows to try the normal shutdown, and if not success, force shutdown automatically after 1 minute?

I tried:

shutdown -f -s -t 60

But I got a terminal printing infinitely:

C:\Users\Wellington\Desktop>shutdown -f -s -t 60
C:\Users\Wellington\Desktop>shutdown -f -s -t 60
C:\Users\Wellington\Desktop>shutdown -f -s -t 60

And I'm not sure if this will try the normal shutdown first...

Tom Brito

Posted 2014-10-12T17:37:46.870

Reputation: 367

Your command looks correct and should work as you intend, except if Windows itself is somehow stuck. Try running the sfc /scannow command. Does Windows shut down correctly when you do it thru the Start menu?

– harrymc – 2014-10-15T06:09:30.347

1If you change that command from shutdown (could be a batch file somewhere in your path named shutdown.cmd doing something weird) to shutdown.exe does the problem repro? – Mark Allen – 2014-10-17T18:55:48.387

Answers

3

AFAIK,there is no direct command to run but you can modify your above command to fulfill your requirement as like this.

shutdown -s -t 60 && shutdown -f

shutdown -s -t 60 || shutdown -f

Try this,It will first do a normal shutdown after 1 minutes if it fails then it will execute force shut down.

or you can write a batch file with using if(condition) and simply run it.

Ali786

Posted 2014-10-12T17:37:46.870

Reputation: 690

I don't really see the difference between this and the command used by the poster. – harrymc – 2014-10-15T06:12:16.590

yes there is no difference but a little the above will not execute force shut down until the normal shut down fails. – Ali786 – 2014-10-15T06:33:06.773

0

do it in powershell?

Start-Job -name shut -ScriptBlock {Stop-Computer}
Wait-Job -Name shut -Timeout 60
Stop-Computer -Force

Just run it in a powershell console or paste that into a 'shutdown.ps1' text file, then right click 'run in powershell'.

Patrick

Posted 2014-10-12T17:37:46.870

Reputation: 1 132

0

The below command will shutdown your computer after 60 seconds and if it fails it'll forcefully shut it down.

shutdown -s -t 60 -f

Alam

Posted 2014-10-12T17:37:46.870

Reputation: 135

0

shutdown -s -t 60 && timeout 60 && shutdown -f -s -t 00

Tim Jonas

Posted 2014-10-12T17:37:46.870

Reputation: 506