RUNDLL & RUNDLL32

You can find these tips @ many locations, This is just another backup copy of it.

References:
http://www.robvanderwoude.com/rundll.html
http://www.mvps.org/vb/index2.html?tips/shellcpl.htm
http://www.jsiinc.com/subh/tip3500/rh3562.htm


3562 » Undocuments paths to Windows 2000 tools.

In addition to tip 3557, Jeffrey W. Horning has provided the following undocumented paths to windows 2000 tools:
Manage Shares             : rundll32 ntlanui.dll,ShareManage - Shares
Create a New Hhare        : rundll32 ntlanui.dll,ShareCreate
Add a TCP/IP Printer      : rundll32 tcpmonui.dll,LocalAddPortUI
Install New Modem         : rundll32 modemui.dll,InvokeControlPanel
Execute Device Manager    : rundll32 devmgr.dll DeviceManager_Execute
Network Id Wizard         : rundll32 netplwiz.dll,NetAccWizRunDll
Add Network Place         : rundll32 netplwiz.dll,AddNetPlaceRunDll

Shortcut to lock the Computer / Workstation in Windows 2000 - C:\WINNT\system32\rundll32.exe user32.dll,LockWorkStation

How can I open a URL from the Windows 2000 command line?



RUNDLL and RUNDLL32 are two utilities supplied with Windows 95/98 and NT.
They can call DLL functions from the command line, allowing us to create extremely powerfull batch files.
Some examples:
  1. Start Control Panel applets (2):
    You can run a Control Panel applet from the command-line by using rundll32 shell32.dll,Control_RunDLL or control.exe followed by the name of the .cpl. If you include the first part of the displayed name followed by a number, you may be able to start the applet with the focus on a specific tab.

    Examples:
    Settings tab on Display properties: start control.exe desk.cpl,Display,3
    Advanced tab on Internet properties: start rundll32 shell32.dll,Control_RunDLL inetcpl.cpl,Internet,5
    Additional Control Panel examples:

    Control Panel    (CONTROL.EXE)
    Control Panel:
        rundll32.exe shell32.dll,Control_RunDLL

    Accessability Options    (ACCESS.CPL)
    Accessability Properties (Keyboard):
        rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1
    Accessability Properties (Sound):
        rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2
    Accessability Properties (Display):
        rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3
    Accessability Properties (Mouse):
        rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4
    Accessability Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5

    Add/Remove Programs    (APPWIZ.CPL)
    Add/Remove Programs Properties (Install/Uninstall):
        rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1
    Add/Remove Programs Properties (Windows Setup):
        rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
    Add/Remove Programs Properties (Startup Disk):
        rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3

    Display Options    (DESK.CPL)
    Display Properties (Background):
        rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
    Display Properties (Screen Saver):
        rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1
    Display Properties (Appearance):
        rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
    Display Properties (Settings):
        rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3

    Display Properties (Install Screen Saver):
        rundll32.exe desk.cpl,InstallScreenSaver %1
    (opens .scr at location specified by %1 in preview window)

    FindFast Settings (FINDFAST.CPL)
    Find Fast Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL findfast.cplInternet Settings (INETCPL.CPL)

    Internet Settings (INETCPL.CPL)
    Internet Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,0
    Internet Properties (Security):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1
    Internet Properties (Content):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,2
    Internet Properties (Connection):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,3
    Internet Properties (Programs):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4
    Internet Properties (Advanced):
        rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,5

    Regional Settings    (INTL.CPL)
    Regional Settings Properties (Regional Settings):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
    Regional Settings Properties (Number):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
    Regional Settings Properties (Currency):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
    Regional Settings Properties (Time):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
    Regional Settings Properties (Date):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4
    Regional Settings Properties (Input Locales):
        rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5

    Joystick Options    (JOY.CPL)
    Joystick Properties (Joystick):
        rundll32.exe shell32.dll,Control_RunDLL joy.cpl

    Mouse/Keyboard/Printers/Fonts Options    (MAIN.CPL)
    Mouse Properties:
        rundll32.exe shell32.dll,Control_RunDLL main.cpl @0
    Keyboard Properties:
        rundll32.exe shell32.dll,Control_RunDLL main.cpl @1
    Printers:
        Win9x: rundll32.exe shell32.dll,Control_RunDLL main.cpl @2
    Fonts:
        Win9x: rundll32.exe shell32.dll,Control_RunDLL main.cpl @3

    Mail and Fax Options    (MLCFG32.CPL)
    Microsoft Exchange Profiles (General):
        rundll32.exe shell32.dll,Control_RunDLL mlcfg32.cpl

    Multimedia/Sounds Options    (MMSYS.CPL)
    Multimedia Properties (Audio):
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
    Multimedia Properties (Video):
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
    Multimedia Properties (MIDI):
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
    Multimedia Properties (CD Music):
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3
    Multimedia Properties (Advanced):
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,4
    = = = = = = = = = = = = = = = = = = = = = = = = = = =
    Sounds Properties:
        rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1

    Modem Options    (MODEM.CPL)
    Modem Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL modem.cpl

    Network Options    (NETCPL.CPL)
    Network (Configuration):
        Win9x: rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl
        WinNT: rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl
    Dial-up Networking Wizard
        Win9x: rundll32.exe rnaui.dll,RnaWizard
    Create Share Dialog
        WinNT: rundll32.exe ntlanui.dll,ShareCreate
    Manage Shares Dialog
        WinNT: rundll32.exe ntlanui.dll,ShareManage

    ODBC Settings (ODBCCP32.CPL)
    ODBC Data Source Administrator (General):
        rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl

    Password Options    (PASSWORD.CPL)
    Password Properties (Change Passwords):
        Win9x: rundll32.exe shell32.dll,Control_RunDLL password.cpl

    COM Ports Settings (PORTS.CPL)
    COM Ports Properties (General):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL ports.cpl

    Server Properties (SRVMGR.CPL)
    Server Properties (General):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL srvmgr.cpl
    Services dialog:
        WinNT: rundll32.exe shell32.dll,Control_RunDLL srvmgr.cpl Services

    System/Add New Hardware Options    (SYSDM.CPL)
    System Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,0
    System Properties (Device Manager):
        Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
    System Properties (Performance):
        Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
        WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
    System Properties (Environment):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
    System Properties (Startup/Shutdown):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
    System Properties (Hardware Profiles):
        Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
        WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,4
    System Properties (User Profiles):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,5
    Add New Hardware Wizard:
        Win9x: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1
    Add New Printer Wizard:
        rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter

    Telephony Settings (TELEPHON.CPL)
    Dialing Properties (My Location / Drivers):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL telephon.cpl

    Themes Settings (THEMES.CPL)
    Themes Properties (General):
        rundll32.exe shell32.dll,Control_RunDLL themes.cpl

    Date and Time Options    (TIMEDATE.CPL)
    Date/Time Properties:
        rundll32.exe shell32.dll,Control_RunDLL timedate.cpl
    Choose Time Zone:
        rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,/f

    TweakUI Settings (TWEAKUI.CPL)
    TweakUI Dialog (General):
        rundll32.exe shell32.dll,Control_RunDLL tweakui.cpl

    UPS Settings (UPS.CPL)
    Uninteruptable Power Supply Properties (General):
        WinNT: rundll32.exe shell32.dll,Control_RunDLL ups.cpl

    Microsoft Mail Postoffice Options    (WGPOCPL.CPL)
    Microsoft Workgroup Postoffice Admin:
        rundll32.exe shell32.dll,Control_RunDLL wgpocpl.cpl

    ====================================================
    SYSTEM WIZARDS
    Open With (File Associations):
        rundll32.exe shell32.dll,OpenAs_RunDLL d:\path\filename.ext

    Run Diskcopy Dialog:
    rundll32 diskcopy.dll,DiskCopyRunDll

    Create New Shortcut Wizard:
    'puts the new shortcut in the location specified by %1
        rundll32.exe AppWiz.Cpl,NewLinkHere %1

    Install New Hardware Wizard:
        rundll32.exe sysdm.cpl,InstallDevice_RunDLL

    View Printers:
        rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder

    Dial-up Networking Wizard
        rundll32.exe rnaui.dll,RnaWizard

    Open a Scrap Document:
        rundll32.exe shscrap.dll,OpenScrap_RunDLL /r /x %1

    Create a Briefcase:
        rundll32.exe syncui.dll,Briefcase_Create

    View Fonts:
        rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder

    Run Format Floppy Dialog:
        rundll32.exe shell32.dll,SHFormatDrive
    (make sure a disk is inserted in Drive A: first!)

    Create a Briefcase:
        rundll32.exe syncui.dll,Briefcase_Create
  2. Install a screensaver (copy the *.SCR file to the Windows directory first) (2):
    RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\Default.scr
    
    The directory shown is for Windows NT, adjust for Windows 95/98
  3. Start "Add New Printer" wizard:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter
    
  4. Start GUI diskette format program:
    RUNDLL32 SHELL32.DLL,SHFormatDrive
    
  5. Logoff Windows (1)
  6. Reboot (1)
  7. Shutdown (1)
  8. Show Windows 9*'s "System setting changed, do you want to reboot now?" dialog (1):
    RUNDLL SHELL.DLL,RestartDialog
    
  9. Display NT's "About" dialog, showing version, servicepack, registered owner and amount of physical memory:
    RUNDLL32 SHELL32.DLL,ShellAboutW
    
  10. Open a file with Windows' "Open as" dialog:
    RUNDLL32 SHELL32.DLL,OpenAs_RunDLL filename
    
  11. Swap your mouse to left handed use (tip from "Speedy Gonzales"): I know of no command yet to undo this, but the following will get you close:
    CONTROL MAIN.CPL
    
    or:
    RUNDLL32 SHELL32.DLL,Control_RunDLL MAIN.CPL,@0,1
    
  12. Start DialUp Network:
    (Credits for these commands: Michael J. Gregg and Tom Lavedas)
    START RUNDLL32 RNAUI.DLL,RnaDial exact name of dialer entry
    TRACERT -h 1 -w 1
    
    The RUNDLL command starts DUN, the TRACERT command is supposed to actually start the dialing process. Since I do not have access to any PC with DUN installed, I could not test the TRACERT command's effect.

 

 

Notes:   1   See my Shutdown page for more information and examples on reboot and shutdown command lines.
  2   By associating *.CPL files with the command
RUNDLL32 SHELL32.DLL,Control_RunDLL %1,@0
and *.SCR files with
RUNDLL32 DESK.CPL,InstallScreenSaver %1
you can open and/or install them by doubleclicking on their icons.

 

The following batch file installs a screensaver if one is specified, and opens the Control Panel applet at the right tab to enable adjustment of its settings (tested in NT only):

@ECHO OFF
IF "%1"=="" GOTO Interact
IF NOT EXIST %SystemRoot%.\System32\%~nx1 GOTO Interactive

RUNDLL32 DESK.CPL,InstallScreenSaver %~f1
GOTO End

:Interactive
RUNDLL32 SHELL32.DLL,Control_RunDLL DESK.CPL,@0,1

:End
OS (1) Command line Effect
DOS ECHO G=FFFF:0000 ¦ DEBUG Reboot (warm boot, sometimes cold boot)(2)
Win31* ECHO G=FFFF:0000 ¦ DEBUG Popup Task Manager, sometimes reboot
Win9* RUNDLL USER.EXE,ExitWindows Shutdown (3)
Win9* RUNDLL USER.EXE,ExitWindowsExec Win95: various results, usualy fast shutdown (and lock PC), sometimes restart Windows, sometimes reboot.
Win98: Restart Windows, sometimes reboot.
Win9* RUNDLL SHELL.DLL,RestartDialog "System Settings Change, Do you want to restart your computer now?" dialog
Win98 RUNDLL SHELL32.DLL,SHExitWindowsEx Logoff (4)
Win98 RUNDLL SHELL32.DLL,SHExitWindowsEx 1 Shutdown
Win98 RUNDLL SHELL32.DLL,SHExitWindowsEx 2 Reboot
Win98 RUNDLL SHELL32.DLL,SHExitWindowsEx 4 Logoff, and start Explorer after relogon
NT See Reboot NT on my Solutions found in alt.msdos.batch page Reboot immediately
NT RUNDLL32 USER32.DLL,ExitWindowsEx Logoff
NT+RK SHUTDOWN /L /T:10 /Y /C Shutdown in 10 seconds, close without saving
NT+RK SHUTDOWN /L /R /T:0 /Y Immediate shutdown & reboot
Kix $RC = SHUTDOWN( "\\server", "Shutting down...", 10, 1, 0 ) Shutdown in 10 seconds, with message, close without saving, no reboot
Kix $RC = SHUTDOWN( "\\server", "", 0, 1, 1 ) Immediate shutdown & reboot
Kix $RC = LOGOFF( 1 ) Logoff, forcing applications to close (use 0 instead of 1 if you don't want to force applications to close)
OS/2 START /PM SHUTDOWN && EXIT Shutdown (5)
OS/2 SETBOOT /IBD:C: Unconditional shutdown & reboot
OS/2 SETBOOT /IBA:nonsense Unconditional shutdown & failing reboot (6)
OS/2 LOGOFF Logoff (both LAN Server client and Peer)
 
Notes:   1   DOS    MS-DOS and PC-DOS
Win31* Windows 3.1, 3.11 and 3.11 for Workgroups
Win9* Windows 95 and 98
Win98 Windows 98
NT Windows NT 4 (and Windows 2000)
NT+RK Windows NT 4 with the NT Resource Kit
Kix Windows (any) with Kix
OS/2 OS/2 Warp 3 and 4, LAN Server and Warp Server
  2   May not work with "exotic" memory managers, like Quarterdeck's QEMM or DesqView; in that case, use RESET.COM instead.
3 Thanks for Bill James and Tom Lavedas, for the information on RUNDLL.
Find more RUNDLL examples I collected on my RUNDLL page.
4 Tested parameters for RUNDLL SHELL32.DLL,SHExitWindowsEx
Parameter    Result
none    Logoff
0    Logoff
1    Shutdown
2    Reboot
3    Reboot
4    Logoff, and start Explorer after relogon
5    Shutdown
6    Reboot
7    Reboot
8    Logoff
This pattern then seems to repeat itself: 8 equals 0, 9 equals 1, etcetera.
Letters are invalid, and are ignored (equal to none).
5 Will still stop and ask for confirmation if a non-PM application is active
6 Needs Boot Manager installed.
Will reboot, no questions asked, and then stop if nonsense is an invalid Boot Manager menu entry (which, in this case, is exactly what we want).