Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Don't want shutdown script to run on restart

23 May 2011   #1

Windows 7 Professional 64-bit
Don't want shutdown script to run on restart


I've got my system configured via gpedit so that it runs a custom batch script when it shuts down. The script can take about a minute to complete because it is telling some external hardware to run through its power down procedure. However when I tell the system to _reboot_ the script still runs and then when the system starts back up it has to run the startup script to power the hardware back up again.

Therefore I wondered if there is a way to tell Windows not to run the script if the action is reboot, not shutdown, or can I get access to the action via some parameters that can be passed to my script?

Searched through forums but can't find any answer to this - maybe the search terms are too common.

Many thanks

My System SpecsSystem Spec

23 May 2011   #2

W7 Professional x64

Unless you can somehow specify in the script to only run on shutdown rather than reboot, I don't see a way in Gpedit, since it tailors purely to startup/shutdown function, and doesn't acknowledge reboots.
My System SpecsSystem Spec
24 May 2011   #3

Windows 7 Professional 64-bit

That's fine, but how can I tell if the current operation is shutdown or restart? Is there a parameter list I can pick up and pass on to the script as command line args?
My System SpecsSystem Spec

24 May 2011   #4

W7 Professional x64

That, I'm afraid, is beyond my realm of expertise. I'm not much of one for scripting. I will try and look into the issue though...
My System SpecsSystem Spec

 Don't want shutdown script to run on restart

Thread Tools

Similar help and support threads for2: Don't want shutdown script to run on restart
Thread Forum
windows 7 restart or shutdown stays at shutdown screen General Discussion
Script to restart an application if it has stopped. General Discussion
Solved Logoff script not running at shutdown General Discussion
VBS script that shutdown other pc in network. Network & Sharing
Restart time script problem Performance & Maintenance
Easy way to run script at shutdown without gpedit? General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:04 PM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33