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

3

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.

karatchov

Posted 2010-05-23T17:40:47.403

Reputation: 417

Answers

2

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.

Keltari

Posted 2010-05-23T17:40:47.403

Reputation: 57 019

1

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)

Hugh Allen

Posted 2010-05-23T17:40:47.403

Reputation: 8 620

It's a good solution, but only if you're making the computer go to sleep manually. – gak – 2012-10-11T08:00:53.640

1

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)

harrymc

Posted 2010-05-23T17:40:47.403

Reputation: 306 093

This doesn't quite work. It requires a time to automatically wake up. – gak – 2012-10-11T07:59:31.457

@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)."

– eis – 2012-10-11T10:32:38.113

@eis It still requires you do specify a time. I suppose if you set the date to the far future, it will not automatically awake. – gak – 2012-10-11T21:47:36.387

@GeraldKaszuba yeah, since it seems to include a year also, you could set it to 2099 or something – eis – 2012-10-12T05:19:09.417