How to hibernate windows pc from cmd

15,299

Solution 1

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)

Solution 2

The problem with that command for Windows is that you should use slashes instead of dashes. Dashes are used to add options in the Linux Terminal. Slashes are for adding options to Windows Command Prompt. Here's what you should use instead.

shutdown /h /t 18000
Share:
15,299

Related videos on Youtube

Program-Me-Rev
Author by

Program-Me-Rev

Love programming. Java, C, C++ are my first languages. Others include, among others, PHP, JavaScript, Python. Frameworks: Spring, Apache Camel, JQuery, React / R.N, including Node.js environment.

Updated on June 04, 2022

Comments

  • Program-Me-Rev
    Program-Me-Rev almost 2 years

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

    This doesn't work:

    shutdown -h -t 18000
    
    • Nick Nikolov
      Nick Nikolov about 9 years
      Try running cmd like administrator
    • TZHX
      TZHX about 9 years
      This doesn't seem to be about programming. I'd say it'd be more on-topic for SuperUser, but it has already been asked there.