Solved

Stop shutdown scripts running when restarting

Posted on 2004-10-14
9
64 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 125 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a quick article, and by no means should you quit your job today or plan to feed your family of 5 on a business idea. Starting a business takes work. This article will only give you the basic skeleton of understanding. Going into business for…
EE introduced a new rating method known as Level, which displays in your avatar as LVL. The new Level is a numeric ranking that is based on your Points. This article discusses the rationale behind the new method and provides the mathematical formula…
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.
Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…

705 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