RunDLL32.exe

Run a 32 bit DLL function.
Rundll32 is available on all version of Windows from Windows 95 onwards, but only runs in 32 bit mode.

Syntax
       RUNDLL32.EXE dll_name,EntryPoint [optional_arguments]

Key
   dll_name     A full path to the DLL to ensure that the correct one is found.
                For best results, use the short file name.

   EntryPoint   The name of the entry point function.

The dll_name and the EntryPoint function name can be separated by either a space ( ) or a comma (,)

In some cases two or more commas are required, for example here we pass the value 1 as the second argument to Intl.cpl:

Rundll32.exe shell32.dll,Control_RunDLL Intl.cpl,,1

DLL options may be case sensitive, Rundll32 may also fail if there is any additional white space in between the dll_name, the comma, and the EntryPoint function. If you pass the wrong type of DLL to Rundll32, it may fail to run without returning any error message.

Rundll32 was originally designed only for internal use at Microsoft. It can be used generally but requires the DLL being called to include a suitable function signature to match the operation you are calling. See the full details in Q164787.

The internet has many lists of Rundll32 'cheat codes' [example], that do mostly work, but many are calling an invalid or missing function signature. This means there is a chance they may stop working (or start working in a different way) after some future Windows update.
There are often more robust methods to achieve the same thing such as Start Run commands or Shell: folder shortcuts.

Examples

Add a Network Printer:

RUNDLL32 printui.dll,PrintUIEntry /ia /c\\server /m "AGFA-AccuSet v52.3"
   /h "Intel" /v "Windows 2000" /f %windir%\inf\ntprint.inf

Add a Local Printer:

RUNDLL32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\\SERVER
   /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"

Add a printer connection that's available to anyone who logs on:

Rundll32 printui.dll,PrintUIEntry /ga /n\\Server\PrintShare

Display the per-Machine printer connections:

RUNDLL32 printui.dll,PrintUIEntry /ge /c"\\workstation64"

Display all the available commands for PRINTUI.DLL - add/remove print drivers, print queues, preferences, properties etc:

RUNDLL32 printui.dll,PrintUIEntry /?

Lock workstation:

RUNDLL32.exe user32.dll, LockWorkStation
n.b. this is an unsupported hack, which may fail in the future - details on oldnewthing
A PowerShell function: Lock-WorkStation is supported.

“If you're rich you can buy books. If you're poor, you need a library” ~ John Kenneth Galbraith

Related commands

Qchange.vbs - Change Printer Connection.
PRNCNFG - Configure or rename a printer.
PRNMNGR - Add, delete, list printers and printer connections.
REGSVR32 - Register or unregister a DLL.
WMIC PRINTER - Set printing options through WMI.
Q164787 - Rundll32 command line.
PowerShell: Get-CIMinstance - Get WMI information.


 
Copyright © 1999-2024 SS64.com
Some rights reserved