Does anyone know of a good batch file syntax which will hibernate a machine?

  • Thread starter Thread starter Spin
  • Start date Start date
S

Spin

Gurus,

Does anyone know of a good batch file syntax which will hibernate a machine?
 
Spin said:
Gurus,

Does anyone know of a good batch file syntax which will hibernate a machine?


As long as Hibernation is enabled in Power Options, the following command in a
batch file will cause the computer to hibernate.

%windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState

If Hibernation isn't enabled, the computer will go into Standby mode. Take a
look at this article for more info.

How To Put the System into hibernation or Standby from Run menu
http://support.microsoft.com/kb/555569

Good luck

Nepatsfan
 
Spin said:
Gurus,

Does anyone know of a good batch file syntax which will hibernate a machine?
Sorry i don't know how to do batch files, but if you run
this:%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate
as a scheduled task it will hibernate your computer at whatever date/time
you want.
 
Nepatsfan said:
I almost forgot, you can also use PsShutdown.

PsShutdown v2.52
http://technet.microsoft.com/en-us/sysinternals/bb897541.aspx

Good luck

Nepatsfan
Hey Nepatsfan, how come when i use %windir%\system32\rundll32.exe
powrprof.dll,SetSuspendState to hibernate my computer it does so but my
wake-up scheduled task doesn't run? In fact because of this i asked the same
question in Aumha forums and one of their experts pointed me to Shutter.exe
which i now use to hibernate my laptop and my wake-up scheduled task works.
%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState blocks my
wake-up task.
 
ManyBeers said:
Hey Nepatsfan, how come when i use %windir%\system32\rundll32.exe
powrprof.dll,SetSuspendState to hibernate my computer it does so but my
wake-up scheduled task doesn't run? In fact because of this i asked the same
question in Aumha forums and one of their experts pointed me to Shutter.exe
which i now use to hibernate my laptop and my wake-up scheduled task works.
%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState blocks my
wake-up task.


I'm not familiar with Shutter.exe so I can't comment on how or why it works for
you. If I get a chance, I'll install it on my test system and see exactly how it
operates. I'm curious to see if it's possible to start a computer with a
scheduled task. Call me a skeptic on this one.

It's always been my understanding that a system in a state of hibernation can
only be scheduled to power up through settings in the BIOS. The Setup program
for many systems has a section where you can schedule the computer to start
automatically.

I'm certainly no expert, but what you're describing goes against my
understanding of the power states available on a computer. When you set a
computer to hibernate, it's essentially shutdown. Since Windows isn't running,
how does it launch a scheduled task? I'll have to see if this Shutter.exe
program actually puts the computer in hibernation and not standby.

If I find out anything interesting, I'll get back to you.

Nepatsfan
 
I'm not familiar with Shutter.exe so I can't comment on how or why it works for
you. If I get a chance, I'll install it on my test system and see exactly how it
operates. I'm curious to see if it's possible to start a computer with a
scheduled task. Call me a skeptic on this one.

It's always been my understanding that a system in a state of hibernation can
only be scheduled to power up through settings in the BIOS. The Setup program
for many systems has a section where you can schedule the computer to start
automatically.

I'm certainly no expert, but what you're describing goes against my
understanding of the power states available on a computer. When you set a
computer to hibernate, it's essentially shutdown. Since Windows isn't running,
how does it launch a scheduled task? I'll have to see if this Shutter.exe
program actually puts the computer in hibernation and not standby.

If I find out anything interesting, I'll get back to you.

Nepatsfan

I know the program wosb (WakeupOnStandBy) can schedule a machine to
power back on if it's put in standby or hibernate. Nice interface too,
you can use either the GUI or the commandline:

http://www.dennisbabkin.com/php/download.php?what=WOSB
 
I'm not familiar with Shutter.exe so I can't comment on how or why it works for
you. If I get a chance, I'll install it on my test system and see exactly how it
operates. I'm curious to see if it's possible to start a computer with a
scheduled task. Call me a skeptic on this one.

It's always been my understanding that a system in a state of hibernation can
only be scheduled to power up through settings in the BIOS. The Setup program
for many systems has a section where you can schedule the computer to start
automatically.

I'm certainly no expert, but what you're describing goes against my
understanding of the power states available on a computer. When you set a
computer to hibernate, it's essentially shutdown. Since Windows isn't running,
how does it launch a scheduled task? I'll have to see if this Shutter.exe
program actually puts the computer in hibernation and not standby.

If I find out anything interesting, I'll get back to you.

Nepatsfan

Since the poster was nice enough to post a link to this Aumha
discussion, it was no problem finding out what shutter.exe is.

At first when I searched for it I got an 11MB photo editing program,
then I found this:
http://www.autohotkey.net/~bLisTeRinG/shutter.html

It looks like it's just wraping the Autohotkey shutdown calls, and
basically it looks comparable to PsShutdown. In scripts I'd normally
use either Nircmd or Autoit shutdown calls which amount to the same
thing. WOSB is also capable of sending the computer to standby or
hibernate.

As far as resuming from standby, as I mentioned before the program
wosb is capable of doing this, and Windows Task scheduler, and others
might as well. It looks like the API calls CreateWaitableTimer, and
SetWaitableTimer are used for this. If there's a WaitableTimer it will
bring the computer out of standby or hibernate.

As far as why his computer was failing to come out, looking at the
SetSuspendState Information:
http://msdn.microsoft.com/library/en-us/power/base/setsuspendstate.asp

There's additional options for standby or hibernate, as well as
"DisableWakeEvent". My guess is that when called from rundll it
defaults to disabling wake events. I can't seem to successfully feed
rundll the additional parameters (and neither can anyone it seems) so
there doesn't seem to be a way to control this behaviour using Rundll
directly.
 
throwitout said:
Since the poster was nice enough to post a link to this Aumha
discussion, it was no problem finding out what shutter.exe is.

At first when I searched for it I got an 11MB photo editing program,
then I found this:
http://www.autohotkey.net/~bLisTeRinG/shutter.html

It looks like it's just wraping the Autohotkey shutdown calls, and
basically it looks comparable to PsShutdown. In scripts I'd normally
use either Nircmd or Autoit shutdown calls which amount to the same
thing. WOSB is also capable of sending the computer to standby or
hibernate.

As far as resuming from standby, as I mentioned before the program
wosb is capable of doing this, and Windows Task scheduler, and others
might as well. It looks like the API calls CreateWaitableTimer, and
SetWaitableTimer are used for this. If there's a WaitableTimer it will
bring the computer out of standby or hibernate.

As far as why his computer was failing to come out, looking at the
SetSuspendState Information:
http://msdn.microsoft.com/library/en-us/power/base/setsuspendstate.asp

There's additional options for standby or hibernate, as well as
"DisableWakeEvent". My guess is that when called from rundll it
defaults to disabling wake events. I can't seem to successfully feed
rundll the additional parameters (and neither can anyone it seems) so
there doesn't seem to be a way to control this behaviour using Rundll
directly.

That is what i was thinking too. The "DisableWakeEvent" parameter is enabled
by default. I was thinking there would be some key in the registry that would
have those parameters and i could change the "DisableWakeEvent" parameter to
false.
Maybe you can figure it out . Thanks for looking in to it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top