Automatically run a script or a program on wake from standby in Windows 7

5,219

Solution 1

Here is a link to a script that monitors the event log. Check the log for what the message is for waking up from standby and you should be good to go.

Solution 2

This free utility might help : WakeupOnStandBy

Can run a file or open a web page at a predetermined time after a wake-up event, during normal operation, or before performing power operation;

(Note: I have no experience with this utility)

Solution 3

There's a possible solution here: Run script on resume from standby: post #4

If you can put your machine into standby mode via a shortcut then then all you need to do is get it to run this batch file:

@echo off
Rundll32.exe PowrProf.dll,SetSuspendState
ping localhost -n 3 > nul
[your code goes here]

(ping is used because Windows lacks a sleep command)

Share:
5,219
karatchov
Author by

karatchov

Updated on September 17, 2022

Comments

  • karatchov
    karatchov almost 2 years

    I have a buggy driver for my Wifi USB dongle. Every time the computer wakes from standby, the wifi is disabled.

    I created a script to restart the device, but I have no idea how to automatically run it when wake from standby.

    I'm using Windows 7 x64.

  • default
    default almost 14 years
  • gak
    gak over 11 years
    This doesn't quite work. It requires a time to automatically wake up.
  • gak
    gak over 11 years
    It's a good solution, but only if you're making the computer go to sleep manually.
  • arka mandal
    arka mandal over 11 years
    @GeraldKaszuba I can see in the screenshot the option "perform these tasks if computer wakes up earlier", would that do what you're after? There's some more details here. It says "If you want to perform scheduled tasks even if computer wakes up earlier than the time specified in item (1), check the appropriate box underneath the date & time control. If checked, this option will first perform all the checked options in item (1), then run a file in the item (2) and trigger additional operations in items (3) and (4)."
  • arka mandal
    arka mandal over 11 years
    @GeraldKaszuba yeah, since it seems to include a year also, you could set it to 2099 or something