56

I'd like to hibernate my windows 7 pc in 10 hours after a download is finished. When I execute this:

shutdown -h -t 36000

All I get is the shutdown help text. Doesn't matter if I'm in admin or normal for the cmd prompt. Is there something I'm missing? I've tried -t 36000 only with the same results. Same with / instead of -.

So either a) it isn't working or b) it has a funny way of telling me about it. Do the power management settings interfere with this command?

Update: The /s switch shuts the computer down (not hibernate). /h is a valid switch. Here's a screenshot of my command:

shutdown cmd screen

galoget
  • 403
jcollum
  • 5,402

3 Answers3

37

The -h switch is used to shut down the computer on Linux, not Windows. The correct command to shut down a Windows computer after 7 hours is:

shutdown -s -t 36000

Windows will show a dialog box with a countdown until the time the computer will shut down.

But, you want to hibernate, not shutdown, and unfortunately, the /h and the /t switch don't work together. As a workaround, you can use the at command to schedule shutdown /h to run at a certain time. For example, it is 3:00pm in my time zone at present, so 10 hours later would be 1:00am. To schedule it to hibernate then, I would run:

at 1:00 shutdown /h

It uses 24-hour time notation, so if you wanted it to hibernate at 1:00pm, you'd run:

at 13:00 shutdown /h

Please note, that while you don't need administrator permissions to run the shutdown command on default Windows installations, you do need them for the at command.

Patches
  • 16,572
37

It doesn't look like the -t option is supported with the -h option for shutdown.

Under Windows 7, you can duplicate what you're trying to do with a .bat script containing the following:

timeout /t 36000 /nobreak
shutdown -h

It will cause the PC to immediately hibernate once timeout is done counting down.

Joe Internet
  • 5,355
14

PsShutdown from Sysinternals can hibernate the computer after a specified amount of time.

psshutdown -h -t 36000
paradroid
  • 23,297