How to activate a program whenever XP wake up from hibernation mode?
My XP is on hibernation mode, when I wake it up, I would like to automatically activate a batch file, I have tried startup folder, which does not work, because XP wake up from hibernation mode without restarting window.Does anyone have any suggestions on how to activate a program? whenever XPis wake up from hibernation mode?Thank everyone very much for any suggestions1 person needs an answerI do too
August 21st, 2010 5:18am

One way is to use a batch file to hibernate. Since you are writing a batch file anyway, this should be no problem for you!When you run the batch file, the system will hibernate... then when you power up to come out of hibernation, the rest of the batch file will execute - the batch file will just continue where it left off.Here is an example of a simple hibernate.bat that when you double click it, your system will hibernate, then when you power up, explorer will open. You can put on your desktop or in your Quick Launch area (for single click action) for testing: @echo offc:\windows\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernatec:\windows\explorer.exe One thing about hibernating you may not know... If you come out of hibernate, if there is no activity or XP does not detect anything to do or nothing is happening, it will go automatically go back into hibernate after 3000 seconds (5 minutes). This is so if for some reason XP comes out of hibernate and it finds nothing to do it will automatically go back to hibernate. This is not a bug, it is a sometime annoying feature.Example: You power up in the morning (after a hibernate the previous nght) see the system start up, go get some beverage and come back later to find that your system has shut off and think something is wrong. This is the way it is supposed to work, but you can make it not do that.Since in the example batch file above, you would be launching explorer.exe after coming out of hibernate, that will count as "something to do" and a good reason to be coming out of hibernate so it will be fine.Just put the rest of the commands you want to run in the hibernate.bat file where the explorer.exe part is. Test it from your desktop.Please vote my posts as helpful so I can get lots of points. I am saving up for a pony!
Free Windows Admin Tool Kit Click here and download it now
August 21st, 2010 2:11pm

@echo offc:\windows\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernatec:\batchfile1.batc:\batchfile2.batc:\batchfile3.batWhen window wakes up from hibernation mode, it should execute 3 batchfiles, but I find out that only the batchfile1.bat is executed, and the rest of execution is gone.Do you have any suggestions on what wrong it is?Thank everyone very much for any suggestions
August 22nd, 2010 4:25am

On 8/20/2010 11:18 PM, oem7110 wrote:My XP is on hibernation mode, when I wake it up, I would like toautomatically activate a batch file, I have tried startup folder,which does not work, because XP wake up from hibernation mode withoutrestarting window.Does anyone have any suggestions on how to activate a program?whenever XPis wake up from hibernation mode?Use a scheduled task and have it run when the computer starts.John
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 2:54pm

When window wakes up from hibernation mode, it should execute 3 batchfiles, but I find out that only the batchfile1.bat is executed, and the rest of execution is gone. After loading all the setting from hibernation mode, and I manually execute those 3 batch files, then it works without missing any one, so it must be something wrong between the process of waking up from hibernation and execute the rest of batch files.Do you have any suggestions on what wrong it is?Thank everyone very much for any suggestions
August 22nd, 2010 3:47pm

I am not too smart with batch files :) and how to get one to exit and start the next one, but surely somebody around here is... I think I remember that you have to use "start" or "call" or something like that to get the next one going...You got the come out of hibernate/run a batch file part working though, right? That is a good start.Please vote my posts as helpful so I can get lots of points. I am saving up for a pony!
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 3:48pm

Do you think that will work or do you know that will work?I created a new Scheduled Task to run the command prompt and tested it by running it manually and it works fine.I set the ST to run at startup and restarted and the command prompt window opens as expected. So far so good.I closed the command prompt window and then hibernated.I powered up to come out of hibernate and there was no command prompt window.I conclude that a ST scheduled to run at system start up does not run when the system comes out of hibernate and that only things that were running when you enter hibernate will be running when you come out of hibernate. Coming out of hibernate does not seem to equal system start up.Am I doing something wrong? Please vote my posts as helpful so I can get lots of points. I am saving up for a pony!
August 22nd, 2010 3:53pm

echo offc:\windows\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernatec:\batchfile1.batc:\batchfile2.batc:\batchfile3.batThat is the exact coding on my batch file without using any "start" or "call"Does anyone have any suggestions on how to make each line of coding executed and get the next one going?Thank everyone very much for any suggestions
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 4:04pm

I try the ST for login too, I think there is no restart or login during the process of hibernation, so ST will not activate any tasks.Therefore the existing approach on batch files will work for my case, but there is some issue needed to work on if I get more than one execution command.Thank everyone very much for any suggestions
August 22nd, 2010 4:13pm

I don't think so either, but maybe we will learn the secret.You can Google some things like "multiple batch files", and get some results that show various methods, but I am not sure which is right. Here is one such result: http://www.computing.net/answers/dos/calling-multiple-batch-files-within-a-batch-file/3482.htmlSomewhere I say this suggestion for a "master" batch file to run three sub batch files back to back:call bat1.batcall bat2.batcall bat3.batYou are almost having it!Please vote my posts as helpful so I can get lots of points. I am saving up for a pony!
Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2010 4:20pm

Somewhere I say this suggestion for a "master" batch file to run three sub batch files back to back:call bat1.batcall bat2.batcall bat3.batOnce I add "call" in front of batch file name, when window wakes up from hibernation mode, only the bat3.bat is executed instead of bat1.bat before adding "call", and the rest of execution is gone. No luck!Does anyone have any more suggestions?Thank everyone very much for any suggestions
August 22nd, 2010 7:35pm

On 8/22/2010 9:53 AM, JoseIbarra wrote:Do you think that will work or do you know that will work?I created a new Scheduled Task to run the command prompt and tested it by running it manually and it works fine.I set the ST to run at startup and restarted and the command prompt window opens as expected. So far so good.I closed the command prompt window and then hibernated.I powered up to come out of hibernate and there was no command prompt window.I conclude that a ST scheduled to run at system start up does not run when the system comes out of hibernate and that only things that were running when you enter hibernate will be running when you come out of hibernate. Coming out of hibernate does not seem to equal system start up.Am I doing something wrong?Yes, you are. Run the task under the system account.schtasks /create /tn TaskName /sc onstart /tr "Your Commands Here" /ru "" John
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 1:47pm

Yes, you are. Run the task under the system account.schtasks /create /tn TaskName /sc onstart /tr "Your Commands Here" /ru "" JohnCould you please tell me how to run the task under the system account? My account is assigned as Administrator, there is no need to sign in when window wakes up from hibernation, because the password is saved. Do I run under the system account? There is an option on schtask to activate task during login, but I try it when window wakes up from hibernation mode, the task does not activate, and I assume there is no login process when window wakes up from hibernation. Am I right?Based on your given code, could you please describe more about how your approach to activate batch file under hibernation mode?Thank everyone very much for any suggestions
August 23rd, 2010 2:20pm

You're right, the task will not run when resuming from hibernation.John
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 2:56pm

Jose is right, unless the scheduled task was already running it will not run when resuming from hibernation. You have a few options.1- Create and run a task that relies on a 'marker', and that runs every minute or so. If the marker is present have the file run certain commands and then kill the task. Create a batch file that will start and run the task and then create the marker and immediately hibernate the machine.2- Rely on third party utility such as Hibernate Trigger: http://www.desimonesystems.com/suspendtrigger/index.php John
August 23rd, 2010 3:29pm

There you go... ;) Hibernate Trigger will work though (or it used to). Haven't tried it in a long time though.The OPs problem at the moment though is with a batch file...Please vote my posts as helpful so I can get lots of points. I am saving up for a pony!
Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2010 3:39pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics