Many programs set themselves to run at startup, or run something once in Windows 2000. This is not that difficult
to do, and simply involves adding a Registry entry.
If you want to add a program that runs at startup for every user in Windows 2000, navigate to the following key:
and add a new String value. The name of the key is arbitrary and is simply used for identification, but the value of the string must be the full drive and pathname to the executable or batch file you want to run. If your program includes switches or options, you must pass them like this (note the use of the quotes):
"<drive><path><program name>" /switch1 /option2
If you want keys in the Run section to execute in a certain order, your best bet is to put them all into a batch file in the order you want them to run in, and then execute the batch file from the key.
To add programs that run only once when you start Windows 2000, add keys in the same fashion to this subkey:
Note: All RunOnce keys expire after they conclude their run, whether or not they exited successfully.
If you want to execute Run or RunOnce for a specific user, you need to modify the key:
where <userID> is the ID number for the user in question. If you want to figure out what user belongs to what ID, look in the key HKEY_USERS<userid>Volatile Environment for the HOMEPATH key, which usually has the username listed in it.
If you want to temporarily disable a Run key, you can do one of two things: rename the path to the executable to something bogus, or you can copy it to another subkey named Run- or something similar. I usually use the first approach and just rename the extension of the file (from .EXE to .EXE.BAK), since it's relatively easy to undo in this fashion.
Note: You must to have appropriate permissions to add a Registry key (i.e., Administrator privileges, usually). Also, if the policy for your system is set not to use Run or RunOnce, these keys won't be executed.
If you want to use a batch file to add a key manually, you can create the key, export it to a file with the extension .REG, and then add it in again by using the REGEDIT command:
REGEDIT /S <importfile>
where <importfile> is the path and name of the .REG file to import. The /S (silent) switch suppresses any messages to the console. (If you're really clever, you can even use this within Run or RunOnce to recursively add entries to Run or RunOnce, where one batch file calls another and so on, but use this with caution; don't create an endless loop.)
Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter.