up vote 7 down vote favorite
7
share [g+] share [fb]

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?

link|improve this question

75% accept rate
But in this case (the case that you use waitfor or something like that) you can't abort the scheduled hibernation.... – keyvan Feb 3 at 21:57
feedback

4 Answers

up vote 13 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.

link|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
feedback

You could also use "timeout" or "watifor" commands in a similar manner.

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

or

waitfor NUL /t 20 || shutdown /h

More here: Windows 7 bat file wait/sleep

link|improve this answer
feedback

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

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.