The process of making a startup script a script that is executed automatically when Windows starts is quite simple. Essentially, you create a script as you normally would, and then take steps to have it executed when Windows starts. There are a few different ways to do this:
Put a shortcut to the script in your Startup folder (usually C:\Documents and Settings\{username}\Start Menu\Programs\Startup). This is by far the easiest to implement, but also the most fragile, because it's equally easy to disable (important if you're setting up a computer for someone else).
If there is more than one user account on a computer, and you want the script to be executed regardless of the currently-logged in user, you can use the "All Users" Startup folder (usually C:\Documents and Settings\All Users\Start Menu\Programs\Startup) instead.
Open the Registry Editor (see Chapter 3), and expand the branches to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. Select New and then String Value from the Edit menu, and type startup script. Double-click on the new Startup Script value, type the name of your script (e.g., c:\scripts\myscript.vbs), and click OK. Although a little more difficult to implement, this setup is a little more robust and transparent than using the Startup folder.[5]
[5] Many viruses install themselves here for precisely this reason. See Chapter 5 for more tips that involve this Registry location.
Likewise, you can implement this solution for all users rather than just the current user by adding the Registry value to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run instead.
A startup script can contain a list of programs that you want run in a specific order when Windows starts, such as connecting to the Internet and then checking your email. (Neither Explorer's Startup folder nor the Registry allow you to choose the order in which programs are run.) But there are other, less apparent uses for a startup script, such as for security or remote administration.
For example, say you've discovered a virus that has infected some or all the computers on a network. By writing a script that eliminates the virus by deleting key files or running an antivirus utility and setting it up as a startup script, you can effectively eliminate the virus from each computer.
But with scripts, you can take it even further: utilize a single script stored on a single computer that is run, over the network, on all computers. This way, you can make changes to the script once and have those changes propagated to all computers effortlessly. So, if you place the script Startup.vbs on a machine called Server in a folder called c:\scripts (drive c: would be shared as "c"), then each client machine should be configured to automatically execute \\server\c\scripts\startup.vbs (using one of the previous methods). The beauty of this is that when you don't want the script to do anything, you can simply leave it intact yet empty. If you find that you need to, say, make a Registry change or copy a group of files onto each computer, just type the appropriate commands into the script and turn on (or reboot) all the client computers. This can turn some administration tasks into very short work.