Solved

Stop shutdown scripts running when restarting

Posted on 2004-10-14
9
59 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
  • 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Surprisingly, there is a lot to Gym battles, and I thought it would be helpful to share knowledge about all the ins and outs of this feature!
Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
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.
Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now