?
Solved

Stop shutdown scripts running when restarting

Posted on 2004-10-14
9
Medium Priority
?
65 Views
Last Modified: 2008-03-04
I have a shutdown script which is extremly useful when shuting machines down but very annoying when it runs on a restart. Is there a way to stop this happening?

Thank you
0
Comment
Question by:davidogdenblue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 24

Expert Comment

by:SunBow
ID: 12312201
how about "shutdown -a"?  [abort]

Syntax can vary by need and operating system used.
Here is good place to start if talking about Windows, DOS, and batch:
http://www.computerhope.com/shutdown.htm
0
 
LVL 24

Expert Comment

by:SunBow
ID: 12312219
> when it runs on a restart. Is there a way to stop this happening?

Do not place it in any of the startup areas, or startup sequence. I may not understand question, in this sense it seems too simple
0
 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12316385
I couldn't find out how to do this myself so I've decided to just have two differnt batch files, one for shutdown and one for restart.

The restart script will simply restart and the shutdown script will do what you want it to do then shutdown.

E.g., restart batch:

/////
shutdown -r -f -t 10
\\\\\

and the shutdown:
//////
del C:\Windows\Temp\*.*
shutdown -s -t 10
\\\\\\

Using the windows utilities to implement shutdown scripts will run the script on both shutdown and restart of your machine as both of them shutdown windows and go from there.

Hope that helped a little bit.

-Edit
0
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12316387
And I meant to just have these on your desktop and use them to restart or shutdown the PC with a simple click of the mouse rather than doing the traditional 'start > shutdown > okay'.

-Edit
0
 

Author Comment

by:davidogdenblue
ID: 12327284
I'm sorry I haven't made myself clear. I don't need a script that shutsdown or restarts the PC.

I have a vbs script that runs an automatic defrag on machines. This is run using a shutdown script. The problem is when I have to restart a machine for whatever reason the shutdown script still runs. I'm looking for a way to only execute the shutdown script on a true shutdown not a restart.
0
 
LVL 1

Expert Comment

by:Edit-HTS
ID: 12330873
I posted that just in case you couldn't find a solution to the shutdown versus restart problem - it's a potential way of getting around the issue.

Instead of Clicking start > Shutdown > restart/shutdown and having Windows run the scripts the normal way, I'm saying you could force the issue by having an executable script that will perform whatever you want it to THEN restart or shutdown.

E.g., your defrag thing.  If you wanted to restart a machine you'd double click the restart script.  If you wanted to shutdown and defrag you'd double click the shutdown script.

Get me?

-Edit
0
 

Author Comment

by:davidogdenblue
ID: 12358271
This method would cause too much confusion for the users, who panic whenever new icons appear on the desktops. I wan't this to be transparent to them if possible.

Ideally I would like to check for a value which is set telling the PC to either shutdown or restart, I assume this would be hidden away in the registry somewhere.

Something like:

if \\"the registry entry" = True then Goto Defrag
else goto NoDefrag
0
 
LVL 1

Accepted Solution

by:
Edit-HTS earned 250 total points
ID: 12366167
Sorry I couldn't help :)

-Edit
0
 

Author Comment

by:davidogdenblue
ID: 12366999
Not a problem, you'll get the points if theres no other way.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Whether you believe the “gig economy,” as it has been dubbed, is the next big economic paradigm shift (https://www.theguardian.com/commentisfree/2015/jul/26/will-we-get-by-gig-economy) or an overstated trend (http://www.wsj.com/articles/proof-of-a-g…
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question