You are currently offline, waiting for your internet to reconnect

Description of the RunOnceEx Registry Key

Support for Windows XP has ended

Microsoft ended support for Windows XP on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

Support for Windows Server 2003 ended on July 14, 2015

Microsoft ended support for Windows Server 2003 on July 14, 2015. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

This article was previously published under Q310593
SUMMARY
This article describes the functionality of the RunOnceEx registry key.
MORE INFORMATION
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows
RunOnceEx has the following features:
  • Status: A dialog box is displayed while the items contained in the registry key are being processed. The entries to be processed are grouped into sections and the dialog box highlights the current section being processed. You can disable the status dialog box feature.
  • Performance: The majority of the commands contained in the Run and RunOnce registry keys create separate processes, which is inefficient. The RunOnceEx registry key does not create a separate process. The RunOnceEx registry key also supports a dependency list of DLLs that remain loaded while either all the sections or some of the sections are being processed.
  • Error Handling: If an exception occurs while calling a function in a DLL, the exception is caught and an error dialog box is displayed to the user. You can suppress this error dialog box by using a flag in the RunOnceEx registry key. You can also set a flag to enable log errors and run the RunOnceEx registry key.
  • Deterministic: The RunOnceEx registry key sorts the entries and sections alphabetically to force a deterministic order.
The Runonce.exe and Runonce.exe.mui files are located at the following locations:
32-bit systems:--------------------C:\Windows\System32\runonce.exe Windows Vista and higher:C:\Windows\System32\en-US\runonce.exe.mui  64-bit systems:--------------------64-bit processes:C:\Windows\System32\runonce.exe Windows Vista and higher:C:\Windows\System32\en-US\runonce.exe.mui  32-bit processes:C:\Windows\SysWOW64\runonce.exe Windows Vista and higher:C:\Windows\SysWOW64\en-US\runonce.exe.mui




In Windows 2000, Windows XP and Windows Server 2003, the RunOnceEx registry key exists by default:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx


In Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2. the RunOnceEx registry key does not exist by default:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx key


RunOnceEx Sample to Run Notepad

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
Title= "My Setup Title"
Flags= dword:00000002

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001
RunMyApp= "||notepad.exe"

Sample Syntax

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
Flags= dword:00000000
Title= "Status Dialog Box Title"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\Depend
0001= " xxx1"
000 X= " xxxx"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\0001
Entry1= "MyApp1.exe"
Entry X= "MyApp2.exe"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\000 x

Notes
  • "xxx1, xxxx" is a dynamic-link library (DLL) or .ocx file name (such as My.ocx or My.dll).
  • "0001, 000x" are section names. Section names can be alphanumeric.
  • "entry1, entryX" are registry string values that point to a program file to run.

Definition of Values and Subkeys

Flagsis a DWORD value located in the RunOnceExkey to enable/disable the following settings.

ValueFunctionFunction definition
0x00000000DefaultAll functions are disabled
0x00000004Check Shell StatusVerifies the shell is ready to accept OLE commands
0x00000008No Error DialogsError dialog boxes are not displayed
0x00000010Create Error Log FileCreate C:\Windows\RunOnceEx.err file if errors occur
0x00000020Create Execution Log FileCreate a C:\Windows\RunOnceEx.log file with status of commands
0x00000040No Exception TrappingDoes not trap exceptions that occur when registering DLLs
0x00000080No Status DialogStatus dialog box is not displayed while RunOnceEx runs

The values are cumulative. If you want "No Status Dialog" and "Create Error Log File," set Flags to hexadecimal 90 (80 + 10).

Title is a STRING value that you can use to fill in the Status dialog box title.

The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\Dependregistry key contains the .dll files and the .ocx files that should be kept loaded in the memory while all sections of RunOnceEx are running.

The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\000X registry keys contain entries to be run. These sections are run in alphabetical order. Therefore, the ...\RunOnceEx\0001section is processed before the ...\RunOnceEx\0002section.

The string values within a ...RunOnceEx\000 xsection contain the commands that should be run for the section. The format is:
" DllFileName| FunctionName| CommandLineArguements"

-or-

"|| command parameters"

For example:
"Line1" = "||my.exe -quiet -url http://www.microsoft.com/"
"Line2" = "shdocvw.dll|DllRegisterServer"
Line1 runs the "my.exe -quiet -url http://www.microsoft.com/" command line. Line2 runs the DllRegisterServer function in Shdocvw.dll.

The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\000 x\Depend registry key contains the .dll files and the .ocx files that should be kept in memory while section 000 xis running.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
232487 Description of the RunOnceEx Registry Key
232509 Syntax for the RunOnceEx Registry Key
For more information about the RunOnce Request, visit the following Microsoft Web site: For more information about, visit the following Microsoft Web site:
A Deep Dive into First Boot Agent (Standard 2009)http://msdn.microsoft.com/en-us/library/dd450713.aspx
Properties

Article ID: 310593 - Last Review: 04/14/2010 09:04:57 - Revision: 2.0

Windows 7 Enterprise, Windows 7 Enterprise N, Windows 7 Home Basic, Windows 7 Home Premium, Windows 7 Home Premium N, Windows 7 Professional, Windows 7 Professional N, Windows 7 Starter, Windows 7 Starter N, Windows 7 Ultimate, Windows 7 Ultimate N, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Standard, Windows Web Server 2008 R2, Windows Server 2008 Standard without Hyper-V, Windows Server 2008 Enterprise without Hyper-V, Windows Server 2008 Enterprise, Windows Server 2008 Datacenter, Windows Server 2008 for Itanium-Based Systems, Windows Server 2008 Datacenter without Hyper-V, Windows Server 2008 Standard, Windows Web Server 2008, Microsoft Windows Server 2003, Enterprise x64 Edition, Microsoft Windows Server 2003, Web Edition, Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems, Microsoft Windows Server 2003, Datacenter Edition (32-bit x86), Microsoft Windows Server 2003, Standard x64 Edition, Microsoft Windows Server 2003, Enterprise Edition (32-bit x86), Microsoft Windows Server 2003, Datacenter x64 Edition, Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems, Microsoft Windows Server 2003, Standard Edition (32-bit x86), Windows Vista Business, Windows Vista Business N 64-bit Edition, Windows Vista Home Basic, Windows Vista Business 64-bit Edition, Windows Vista Home Basic N, Windows Vista Home Basic N 64-bit Edition, Windows Vista Enterprise, Windows Vista Business N, Windows Vista Ultimate, Windows Vista Starter, Windows Vista Home Premium, Microsoft Windows XP Professional, Microsoft Windows XP Professional x64 Edition, Microsoft Windows XP Home Edition

  • kbinfo kbsetup KB310593
Feedback
dy>f?DI=4050&did=1&t=">/html>