How to hibernate windows pc from cmd

Program-Me-Rev picture Program-Me-Rev · Feb 16, 2015 · Viewed 13.5k times · Source

How can I set my computer to hibernate after, say 18000 seconds?

This doesn't work:

shutdown -h -t 18000

Answer

Program-Me-Rev picture Program-Me-Rev · Feb 16, 2015

From the question: Hibernate computer from command line on Windows 7, Phoshi's answer does it:

The hibernation time for cannot be set, unfortunately.

This works, though.

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 ctl+c will make to automatically shutdown after pressing)