Solved

Stop shutdown scripts running when restarting

Posted on 2004-10-14
9
61 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IPhone using PC internet 17 66
Remove row and column 3 60
URL to download QuickBooks Pro 2013 2 50
Zavio B7510 5M manual download 2 42
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…
If you want to move up through the ranks in your technology career, talent and hard work are the bare necessities. But they aren’t enough to make you stand out. Expanding your skills, actively promoting your accomplishments and using promotion st…
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…
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…

832 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