The Windows Learning Center

Using Rundll32.exe in Windows XP

Learn how to create a whole new family of useful commands and shortcuts by making use of rundll32.exe. This article tells how to get access to new functions by using it with DLL files.

Although they are not directly executable as programs, the many DLL files present in Windows contain libraries of functions that are used throughout the operating system and in application software. (See this link for an easy-to-understand explanation of what DLL files are.) Generally, the functions of DLL files are used internally by programs and are not directly visible to the computer user. However, Windows contains a file rundll32.exe that allows access to certain functions that are explicitly written to be available to this executable file. This article explains how to use some of these for a variety of time-saving shortcuts and give examples for Windows XP. Windows Vista and Windows 7 are discussed on another page.

Syntax for using Rundll32.exe

The syntax for using Rundll32.exe must be followed precisely and is as follows:

RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>

The DLL name may not contain any spaces, commas or quotation marks. If the DLL name does contain spaces, use the short (8.3) version of the file name. Note that there must be a comma between the DLL name and the entry point. Also, the name of the entry point function is case-sensitive, and there can't be any spaces between the DLL name, the comma, and the entry point function name. If the DLL file is not in a folder contained in the system path environment then the full path must be used for the DLL name. See the Microsoft Knowledge Base for more details.

Shortcuts and commands using Rundll32

Rundll32.exe is used internally by Windows for a variety of DLL functions not exposed to the PC user but there are a number of DLLs that contain entry points available for external use.

These DLLs can be employed with Rundll32.exe for a variety of commands that can be entered into Start-Run, a command window, or used in scripts. A favorite is Shell32.DLL, which is often used to open various Control Panel applets. (Another method specific to Control Panel is discussed here.) For example, to open the Control Panel applet for configuring the display properties enter

RUNDLL32.EXE SHELL32.DLL,Control_RunDLL desk.cpl,,0

Different tabs for the Desktop applet can be opened by changing the number at the end that is part of the argument. All of the Control Panel applets and their tabs can be opened this way by using the relevant CPL file and the appropriate tab number as arguments. The operating system also uses this method to display Control Panel. In fact, Control Panel applications are some of the most commonly mentioned examples in discussions of using Rundll32.exe. Examples of some different applications are discussed below.

Two sources for commands are these:

The latter site listed above has a discussion of the many options for command line printer control using Rundll32.exe and printui.dll. If you open a command window and enter the line below an extensive list of options will be shown. There are a variety of possible uses.


Another example is a command that allows you to switch the mouse-buttons for left-hand use. Unfortunately, once the switch is made it seems that it can only be undone by the old-fashioned method of going to Control Panel. In other words, it doesn't act as a toggle but seems to be one way. The command is

RUNDLL32.EXE USER32.DLL,SwapMouseButton

If you need to switch the button settings back and forth, the command given below will take you to the mouse settings dialog

RUNDLL32.EXE SHELL32.dll,Control_RunDLL main.cpl @0,0

A further example is a command that brings up the "Open with.." dialog box for a particular file myfile.ext given as an argument. The full path for myfile.ext must be used unless its folder is in the path environment.

RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL <myfile.ext>

The Safely Remove Hardware icon that is displayed in the notification area (also called the System Tray) when USB devices are attached can sometimes fail to appear. The utility can be opened by a command

RUNDLL32.EXE SHELL32.DLL,Control_RunDLL HotPlug.dll

The foregoing examples are a only a few of those listed in the references given above. Depending on their pattern of usage and level of computer expertise, PC users may find a variety of others that are of interest.

How to create shortcuts using Rundll32.exe

Many of the commands using Rundll32.exe are used in scripts and shortcuts. Creating a shortcut using one of the commands is very easy. Right-click in an empty spot in the folder where you want the shortcut to be located and choose New-Shortcut from the context menu. Enter the desired command in the line "Type the location of the item." Click "Next," choose a name, and click "Finish."

A shortcut that I personally like opens the dialog box for editing the Favorites in Internet Explorer. The command is

RUNDLL32.EXE shdocvw.dll,DoOrganizeFavDlg

Another favorite will put your computer into hibernation mode (assuming your power management supports this). The command for a shortcut is

RUNDLL32.EXE PowrProf.dll,SetSuspendState

Error messages involving Rundll32.Exe

Since Rundll32.exe is involved with many processes in Windows, it isn't uncommon that error messages crop up that include references to it. That does not mean that Rundll32.exe is itself the actual culprit. More often than not the problem lies elsewhere, such as the DLL file that is being called. Persistent error messages may also indicate infection by a virus or a spyware or Trojan problem.

Determining which modules are being executed by Rundll.32.exe

The Windows XP tool Tasklist can be used to determine what program modules are currently being executed by rundll32.exe. (For discussion of Tasklist, go to this page.) To create a list of running tasks, open a Command Prompt window and enter the following command:

tasklist /m /fi "IMAGENAME eq rundll32.exe" > C:\rundll32.txt

This will create a text file rundll32.txt on the C: drive that lists the running modules. If you prefer a different location for the text file, modify the command accordingly. Also, to simply view the running tasks in the command window, omit the part of the command that does file redirection.

Windows Vista and Windows 7

Some examples of commands that can be used with rundll32.exe in Windows Vista and Windows 7 are given on another page.