Running Programs at Startup

The Run and RunOnce subkeys are useful for running programs automatically when the computer starts or when users log on to the computer. In fact, these keys are a handy way to deploy software that requires administrator privileges. You learn about this use for these keys in Chapter 15, "Working Around IT Problems."

The Run and RunOnce keys are in two different locations. First you see these subkeys in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion. Commands here run when any user logs on to the computer. You also see these subkeys in HKCU\Software\Microsoft\Windows\CurrentVersion. Commands in this branch run after the specific user logs on to Windows XP. As well, Windows XP treats commands in Run differently than commands in RunOnce:

  • Run. Windows XP runs the commands in this subkey every time a user logs on to the computer.

  • RunOnce. Windows XP runs the commands in this subkey once and then removes the key from RunOnce after the command completes successfully.

To add a command to Run or RunOnce in HKLM or HKCU, create a REG_SZ value that has an arbitrary but descriptive name. Put the command line you want to execute in the new value. For example, the Run key in HKCU has the value MSMSGS by default, and this value contains "C:\Program Files\Messenger\msmsgs.exe" /background, which runs Windows Messenger every time the user logs on to Windows XP. Although you might have occasion to add commands to the Run subkey, it's more common to remove commands from this subkey to prevent programs from running when you start or log on to Windows XP.



Microsoft Windows XP Registry Guide
Microsoft Windows XP Registry Guide (Bpg-Other)
ISBN: 0735617880
EAN: 2147483647
Year: 2005
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net