jump to navigation

This is NOT the official website of AvantBiz Consulting Limitd but just some casual discussions about various topics. Please visit www.avantbiz.com if you need our professional services.

Add startup and shutdown scripts in Windows January 30, 2009

Posted by klyuen in : Computer 電腦 , trackback

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).

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
    (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 bellowClick “OK”
  4. Navigate through the left panel by opening each branch like this: Console Root -> Computer configuration -> Windows Settings -> Scripts (Startup/shutdown) 
  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.

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

(Quoted from tutorial5.com)

Comments»

no comments yet - be the first?