[Home] [Tim] [Tina] [Brynn] [Baby Lesher]

Quirks of Run and RunOnce

This material originally appeared in the November 1998 issue of Windows Developer's Journal (copyright 1998 Miller Freeman Inc.) and is reproduced here with permission of the publisher.

Windows 95, Windows 98, and Windows NT have a set of registry keys named "Run" and "RunOnce" located under

HKEY_LOCAL_MACHINE
  \Software
    \Microsoft
      \Windows
        \CurrentVersion

Every time a user logs in to the machine, Windows enumerates all values stored under "Run" and "RunOnce" and treats each value's data as a command. During login, Windows executes all commands listed under "Run". Windows also executes commands listed under "RunOnce", but deletes each registry value, so the command will not execute again during subsequent logins. You can use these keys to automate tasks during user login or to replace files that were in use during a previous session. However, there are a few quirks programmers should know about to avoid potential problems:

[Home] [Tim] [Tina] [Brynn] [Baby Lesher]