Windows 7 Sleep/Suspend: How to execute a batch file before Sleep


  • I have a batch file on a machine (Machine A) that when I wake it up from sleep it utilizes the utility psshutdown which wakes up another machine (Machine B) on my network.  This part works without fail.  What I would like to do is when I put the machine (Machine A) to sleep, right before it sleeps, send a command using psshutdown to put the other machine (Machine B) to sleep as well.  Unfortunately, every time I try to execute this the machine (Machine A) will fall asleep before the script is done executing and never puts the machine (Machine B) to sleep.  Is there a way to either wait for the script to finish before it puts Machine A to sleep or just delay sleep for x amount of time?  Thanks in advance for your response.
    Thursday, July 29, 2010 3:05 PM


  • Hi,


    Based on my research, this seems cannot be realized via batch file. You can check if this can be done by script. Check it in Script Center. Or you can post a thread on Script Center Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    • Marked as answer by Linda Yan Thursday, August 05, 2010 1:31 AM
    Wednesday, August 04, 2010 8:53 AM