Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to hibernate my computer from the command. I was using shutdown /s /t 20 to shutdown the the computer. I change /s to /h to hibernate and now it just returns the usage text as if it doesn't recognise what I have entered. In this is does say

/h         Hibernate the local computer.

Is there something else that I need to use with /h to get it to hibernate?

share|improve this question
    
But in this case (the case that you use waitfor or something like that) you can't abort the scheduled hibernation.... – user116726 Feb 3 '12 at 21:57
up vote 60 down vote accepted

I don't believe you can set a time for hibernation, unfortunately.

Try:

ping -n 20 127.0.0.1 > NUL 2>&1 && shutdown /h /f

The ping is a hackish way of delaying the action. -n 20 should wait for 20 seconds.

(the double && will allow you to do a Ctrl+C to cancel the operation, if you use a simple & then Ctrl+C will make to automatically shutdown after pressing)

share|improve this answer
    
Thanks, worked perfectly. – Android Dec 15 '09 at 10:22
    
haha, +1 for this nice "sleep" replacement :) i wrote my own .exe to do this, but .. hehahahahr. – akira May 26 '10 at 7:42
3  
Why we can't set time for hibernate? it wouldn't difficult for windows developers to allow this feature. but why they didn't? O.o – Amirreza Nasiri Oct 17 '14 at 4:35

You could also consider using "timeout" or "waitfor" commands in a similar manner.

timeout /t 20 /NOBREAK > NUL && shutdown /h

or

waitfor NUL /t 20 || shutdown /h

More here: How do I make a batch file wait / sleep for some seconds?

share|improve this answer

I think that it complains about time. Just put shutdown /h and it should work.

share|improve this answer

I use the following:

sleep 20 && shutdown /h /f

Or this if I want it off at a certain time:

At 22:30 shutdown /h /f
share|improve this answer

Of course you can set TIME for hibernation.

If You really want to hibernate your computer after a specific time, all you need to do is to enter this command below into the cmd i.e:

    timeout /t 36000 /nobreak & shutdown /h

Now the computer will start to count down from 36000 to 0 before it will hibernate. But you should note that you can change 36000 into any number of seconds that suits you.

share|improve this answer

If you have cygwin it's very simple: sleep 45m && shutdown /h

You can instruct sleep in minutes, hours, seconds and even days. Check out this answer about sleep.

share|improve this answer

Did you try the Windows Task Scheduler? If you have the script you can set it to run at a certain time - this should answer the time delay question.

share|improve this answer

i always use this:

shutdown -h

share|improve this answer
    
It doesn’t matter, you can’t time a hibernation (for some reason). – Synetech Dec 14 '13 at 23:38
    
@Synetech It wouldn't difficult for windows developers to allow this feature. but why they didn't? O.o – Amirreza Nasiri Oct 17 '14 at 4:35

Instead of / use -.

Use the below command in the CMD as admin priv and test

shutdown -h
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .