RUNDLL32 - CMD


Overview

RUNDLL32 is a Windows command line utility used to execute functions defined in a DLL file. It allows users to call these functions directly from the command line, providing a bridge between the dynamic link libraries and the Windows operating environment. This tool is exceptionally handy for automation tasks, troubleshooting, and running tasks that do not have an explicit interface.

Syntax

The basic syntax for the RUNDLL32 command is as follows:

RUNDLL32.EXE {DLLname,EntryPoint [arguments]}
  • DLLname: The path and name of the DLL file that contains the function you want to run.
  • EntryPoint: The name of the function you want to execute inside the DLL.
  • arguments: The arguments to pass to the function, if any are needed.

Options/Flags

RUNDLL32 is straightforward with no specific flags or options. All variability comes from the DLL and function invoked and the arguments passed to them.

Examples

Here are some practical examples of using RUNDLL32:

Example 1: Opening the Control Panel

RUNDLL32.EXE shell32.dll,Control_RunDLL

Example 2: Adjusting display settings

RUNDLL32.EXE shell32.dll,Control_RunDLL desk.cpl

Example 3: Clear Print Queue

RUNDLL32.EXE printui.dll,PrintUIEntry /Xs /n "Printer name" queued

Common Issues

  • Incorrect Function Name: If the function name does not exist in the DLL, the command will fail. Ensure the function name is spelled correctly.
  • DLL Issues: If the DLL is corrupt or missing, RUNDLL32 cannot execute the function. Verify the file’s integrity and presence.
  • Administrative Rights: Some DLL functions might require administrative privileges to run. Always ensure adequate permissions are granted.

Integration

RUNDLL32 can be combined with other CMD commands in batch scripts or used with task scheduling to automate specific tasks. For example, you can create a batch file to clean print queues periodically:

@echo off
RUNDLL32.EXE printui.dll,PrintUIEntry /Xs /n "Printer name" queued
echo Print queue cleared!
  • REGSVR32: Used to register and unregister DLL files and ActiveX controls in the Windows Registry.
  • DLLHOST: Command for running DLLs as applications, helpful in different contexts like COM Surrogate processes.

For a deeper understanding and further examples, Microsoft’s official documentation and resources like MSDN or TechNet provide extensive information on various standard and lesser-known system tasks involving RUNDLL32.