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
daropez

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

Hi,

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
WebMattR

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
daropez

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
WebMattR

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
Reply

 Don't want shutdown script to run on restart




Thread Tools





Similar help and support threads
Thread Forum
Single Monitor shutdown script
Hi I have recently started using multiple monitors but due to my second monitor having a VGA connection it defaults to the primary display when starting up and it shows the bios and windows log on and only once windows has started will it revert back to my DVI primary display. My question is:...
Customization
windows 7 restart or shutdown stays at shutdown screen
New laptop lenovo ideapad from january i run a lot of programs for engineering on it works great. But it seems after a while online listening to music and browsing flash/shockwave whatever begins to crash if i exit out of chrome i cannot re open but i can open ie. running mcafee enterprise and...
General Discussion
Script to restart an application if it has stopped.
I have the following script on an XP computer and it successfully detects whether an application has stopped or is not responding. It kills if required and restarts. But it doesn't work on Windows 7. How can I either fix, or do the same thing another way on Windows 7? On XP if the app is...
General Discussion
Logoff script not running at shutdown
I have a script that launches Ccleaner and needs to run at shutdown. Shutdown scripts do not run within the user space as I understand, so I figured I'd use a logoff script which will run while the user is still logged in. The logoff script works when logging off as expected, but does not run...
General Discussion
VBS script that shutdown other pc in network.
Hi, I got an VBS script to shutdown pc in network remote.. Option Explicit Dim objShell, strComputer, strInput Dim strShutdown Do strComputer = (InputBox("Computer name", "Computer Name")) If strComputer <> "" Then
Network & Sharing
Restart time script problem
I was using the restart script from the above stickied reboot time post. It was working fine now all of a sudden it says Can't Fine script engine "VBScript" for script I havnt done anything but uninstall mcafee and install comodo firewall with avast anti virus. Under associate programs it says...
Performance & Maintenance

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 12:54.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App