Article ID: 281820 - View products that this article applies to.
This article was previously published under Q281820
You typically use RunOnce entries to open applications one-time only, either when a system startup occurs or when a user logs on, depending on where the RunOnce entry is added in the registry. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
137367You can use RunOnce entries in device INF files to invoke external code to run after an installation completes. This article discusses the limitations of using RunOnce in device INF files.
(http://support.microsoft.com/kb/137367/EN-US/ )Definition of the RunOnce Keys in the Registry
If you use RunOnce entries in an INF file to invoke external code after an installation completes, you must restrict the usage to calling Rundll32.exe to provide a DLL file. This allows the DLLs to run during a server-side installation of a signed INF file. For example:
You should not use RunOnce to start a setup or to start other monitoring applications because RunOnce prevents the system from performing a server-side installation of your device.
[DeviceInstall.RunOnce.AddReg] HKLM,%RunOnce%,"Name_Of_The_Entry",,"rundll32.exe Name_Of_The_dll,Entry_Point_In_To_The_DLL Argument1, Argument2,..etc."
During a server-side installation of a signed INF file, RunOnce is not invoked directly; rather, the device installer (SetupAPI functions) intercepts the registry entries in the INF file, and then calls the DLL directly as if invoked by the Rundll32.exe file through a RunOnce entry.
All RunOnce entries in the registry are run in the following cases:
NOTE: Instead of using RunOnce entries, the preferred way is to use the coinstaller wherever possible.
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/158022/EN-US/ )RunOnce Registry Key Runs Program at Every Startup