Rundll32.exe is the 32-bit version of Rundll.exe – a simple Windows Command Prompt utility used to invoke functions exported from DLL that are explicitly written to be called by it.
Due to its simplicity of calling Windows DLL and highly scriptable feature, Rundll32.exe becomes a “toy” of many lazy or novice programmers! The simple command syntax allows users to easily writing Windows Shell Scripts or Batch Command files to manage or automate some of the Windows functions.
Rundll32.exe command syntax:
In brief, the Rundll32 command works as this
For more programming information on writing a Windows DLL with exported functions for calling by Rundll32, you can refer to the samples in Microsoft Knowledge Base article KB164787
Create a shortcut to execute Rundll32-related function
Don’t get tired of repeatedly typing long command syntax! Indeed, you can use the conventional Windows shortcut to execute Rundll32.exe function – Just copy the complete Rundll32.exe command syntax in the “Type the location of the item:” text-box of Create Shortcut dialog box!

Some of the common Rundll32.exe command examples and its function
Unless explicitly specified, some of these Rundll32.exe command are tested to work on Windows Vista Ultimate too!
Execute Control Panel-related applets with Rundll32 utility
References:
1) Using Rundll32.exe in Windows XP of Victor Laurie.
2) Ultimate RunDLL32.exe reference by Dx21
3) Shell Scripting Control Panel Applets and System Wizards by Karl Peterson
4) RunDLL32 FAQ by MediaChange
5) Rundll.exe vs Rundll32.exe by Rob van der Woude


Due to its simplicity of calling Windows DLL and highly scriptable feature, Rundll32.exe becomes a “toy” of many lazy or novice programmers! The simple command syntax allows users to easily writing Windows Shell Scripts or Batch Command files to manage or automate some of the Windows functions.
Rundll32.exe command syntax:
Rundll32.exe DLL_NAME,Entry_Point Optional_Argument- DLL_NAME
- If it’s not specified in full path, Rundll32 will search for the given DLL file-name in the Windows directories that defined in %PATH% environment variable. To ensure the correct DLL is called, it’s recommended to specify it in full path. Try not to use long file name, e.g. convert C:\”program files” to “C:\progra~1″. Also, take note that the comma “,” is mandatory in between DLL_NAME and ENTRY_POINT!
- Entry_Point
- The name of the exported function, that’s special written to be called by Rundll32.exe
- Optional Argument
- Non-compulsory function switches to be passed in for execution.
RUNDLL32.exe command syntax for Control Panel files
Rundll32 Shell32.dll,Control_RunDLL Control-Panel.CPL,@n,t
where
Control-Panel.cplis the Control Panel-related files that normally stored in %WINDIR%\system32 directory.
nis the zero-based number of the applets within the Control Panel files (*.CPL)
tis the number of the Tabs of a multi-pages applets
Alternatively, you can replace Rundll32 with Control.exe too!
In brief, the Rundll32 command works as this
- Load the specified Windows DLL via LoadLibrary method
- Retrieve the address of Entry_Point function via GetProcAddress method
- Call the Entry_Point function and passing the optional command arguments to it
- Unload the DLL and exit after the Entry_Point function call is returned
For more programming information on writing a Windows DLL with exported functions for calling by Rundll32, you can refer to the samples in Microsoft Knowledge Base article KB164787
Create a shortcut to execute Rundll32-related function
Don’t get tired of repeatedly typing long command syntax! Indeed, you can use the conventional Windows shortcut to execute Rundll32.exe function – Just copy the complete Rundll32.exe command syntax in the “Type the location of the item:” text-box of Create Shortcut dialog box!
Some of the common Rundll32.exe command examples and its function
Unless explicitly specified, some of these Rundll32.exe command are tested to work on Windows Vista Ultimate too!
Rundll32 User32.dll,LockWorkStation- Lock Windows Desktop – similar to “Lock This Computer”
Rundll32 Printui.dll,PrintUIEntry /?- To bring up command line version of Windows printer user interface to manage printer devices in batch file or Windows shell scripts.
Rundll32 User32.dll,SwapMouseButton- Swap the left mouse-button to function as right-mouse button and right-mouse button to function as left-mouse button – convenient to left-handed users! However, to reverse back, you have to do it in the Mouse Properties dialog box (see next example)!
Rundll32 Shell32.dll,Control_RunDLL main.cpl @0,0- Bring up Mouse Properties dialog box that used to configure the behavior of computer mouse!
Rundll32 Shell32.dll,Control_RunDLL HotPlug.dll- This is command is nice to know if the “Safely Remove Hardware” icon doesn’t appears in or is missing from the System-Tray (bottom-right, near to time display area), when you want to safely unplug an USB Mass Storage device!
Rundll32 IEdkcs32.dll,Clear[ Not tested on Vista ]- To unconditionally remove irritated branding found in the Internet Explorer title bar!
Rundll32 Shell32.dll,OpenAs_RunDLL Any_File-name.ext- Bring up “Open With…” dialog box for the Any_File-name.ext file specified (optional).
Use this with caution – See comment (Thanks Heath Haskins).
Rundll32.exe PowrProf.dll,SetSuspendState[ Not tested on Vista ]- Hibernate function is out-dated. Windows Vista prefers to use Hybrid Sleep or pure Sleep mode function [ See why Windows Vista never power-off by default ]
Rundll32.exe shdocvw.dll,DoOrganizeFavDlg- Bring up Internet Explorer Favorite manager, that’s used to manage Favorite folders.
Rundll32 Shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder- Bring up the Windows Printer management folder.
Rundll32 Shell32.dll,SHHelpShortcuts_RunDLL FontsFolder- Bring up Windows Fonts installation folder.
Rundll32 Shell32.dll,SHHelpShortcuts_RunDLL Connect- Bring up Map Network Drive wizard.
Execute Control Panel-related applets with Rundll32 utility
Rundll32 Shell32.dll,Control_RunDLL- This long command is equal to typing
controlin the Command Prompt, that’s to bring up Windows Control Panel!
Rundll32 Shell32.dll,Control_RunDLL Ups.cpl- Bring up the Power Options window.
Rundll32 Shell32.dll,Control_RunDLL Timedate.cpl- Bring up Date And Time window
Rundll32 Shell32.dll,Control_RunDLL Sysdm.cpl,,3- Bring up System Properties and focus at Advanced tab.
Rundll32 Shell32.dll,Control_RunDLL Mmsys.cpl,,0- Bring up Sound properties dialog box
Rundll32 Shell32.dll,Control_RunDLL Intl.cpl,,0- Bring up Regional and Language Setting dialog box
Rundll32 Shell32.dll,Control_RunDLL Inetcpl.cpl,,6- Bring up Internet Explorer’s Internet Properties dialog box.
References:
1) Using Rundll32.exe in Windows XP of Victor Laurie.
2) Ultimate RunDLL32.exe reference by Dx21
3) Shell Scripting Control Panel Applets and System Wizards by Karl Peterson
4) RunDLL32 FAQ by MediaChange
5) Rundll.exe vs Rundll32.exe by Rob van der Woude


Custom Search



2013 •
[...] a Windows Shell Scripts to programmatically clearing all IE7 browsing history, take a look on these RunDLL32 samples that calling the InetCpl.cpl exported [...]
WARNING!!!!!
I messed up my system BAD using the OpenAs_DLL command. Here is what happened.
I was playing with the different shell comands and ran the follow: rundll32.exe shell32.dll,OpenAs_DLL C:\windows\system32\notepad.exe
When the Open With dialog opened, I browsed to C:\windows\system32\cmd.exe and selected it. What happened next was Insane. All of my exe files associated with cmd.exe, which in turned cause a loop, because cmd.exe is and exe file, that is associated with cmd.exe … you see where im going with this.
I was able to restart the computer and tried everything in my hackerly way to fix it. I ran the ‘FixIt’ program, selected defualt progams, even went so far as to build a .reg file inside the command line to try and get the registry back to normal. Nothing worked! The file association was not corrupt so all the fixes did not work. I tried running the reverse of OpenAs, but as it turned out you can select “%”1″ as an association. I finally resorted to restoreing my system files to a backup I took last week. bad part was, it was my profile that had been affected aswell. Loged into my computer with the admin account, copied the profile to a different location, restarted, and ran the restore again. Once the restore was back up, i deleted the first profile, and logged in. This time I got defualty profile, and all was well. I put my documents back in place and have continued on. It is a SERIOUS mess up, and be VERY CARFUL if you plan on using it.
-Heath Haskins-
-TLG – IT HelpDesk-