Latest tutorial: Premium Flash Files | Ask Tutorial5! | Subscribe to RSS Register Login Find Hobbies
Advertisement

Get tutorials on EMail




Do you need more help? You can now Ask Tutorial5! and get free support - Ask a question now!

How to: Add startup and shutdown scripts in Windows

(7 votes)
Written by Mihai Dobos   
There are some features of Microsoft Windows that can come very handy from time to time if you know how to use them. Startup and shutdown scripts feature is one of that.

Firstly, you should know what scripts are all about. A script is a set of commands that your system can run in order to automate tasks.

If you'd like to run 2 programs and 20 commands every day for example, you don't have to do this by hand. Simply use batch files or Visual Basic scripting and they're done by a click of the mouse.

*NOTE: Learn some scripting basics if you are a novice; scripts that are not corectly written can block the computer, the windows startup process or the windows shutdown process.

For example, here is how you can delete all files in a folder (let's say c:\temporary\) with a script:

1. Create a file called script.bat (Right click - New -> Text document and open it with notepad; now click File - Save as and write it's name and extension - .bat with the option Save as: All files)

2. Add the line bellow and save the file.

del /q c:\temporary\*

By running this batch file you will delete all files in that folder (/q forces delete without confirmation).

01-script.jpg

This is a very simple script; the posibilities are endless and you should learn to use visual basic scripting if you want to build some proffesional work.

Now if you want to integrate any kind of script to automatically run when Windows starts or shuts down (user logon/logoff), you must follow these steps:

1. Click Start - Run and type mmc

02-run mmc.jpg

(note that you must be logged in with an administrator account for this)

2. On the Management console that starts, click File -> Add/Remove Snap-in.

3. On the window that opens, search for Group Policy Object editor on the left panel, click Add and in the properties window that pops out leave the settings that are selected (Local computer) and click ok. The result should be like in the picture bellow

03-add snapins in mmc.jpg




Click "OK"

4. Navigate through the left panel by opening each branch like this: Console Root -> Computer configuration -> Windows Settings -> Scripts (Startup/shutdown)

04-scripts startup - shutdown.jpg

5. Open the properties window for Startup or Shutdown as you desire from the right panel; on the window that pops out add, edit or remove scripts that you want.

05-script selector.jpg


This works on Windows 2000/2003/XP and Vista. Hope you found this useful.



Subscribe now via RSS feed and get all the new tutorials

written by Frank , February 12, 2008

Interesting concept, but it doesn't execute the script at shutdown.
written by vikram , February 19, 2008

thank u lot
pls send some more interactivity on writing batch file
written by alvin , March 13, 2008

how to shutdown a computer using time delay ?
written by Mihai Dobos , March 13, 2008

Hello Alvin


Open a command prompt (Start menu - Run - cmd) and type "shutdown /?". The shutdown command lets you shutdown, restart, log off, etc your PC after a given period of time.

written by vinitha , April 04, 2008

how to shutdown a client in a network
written by Kabeer Siddiqui , April 27, 2008

script for shutdown the multiple computers ?
written by Rudi ludick , May 09, 2008

Hi

How can i shutdown a remote pc that is not part of a domain but is in a workgroup? If i use the shutdown command i get access denied.Could some one please help with this?

Do you need more help? Ask now!
 

busy
Last Updated ( Thursday, 13 March 2008 )