Rundll32 Shortcuts
Execute administrative functions in many DLLs with this command-line tool.
June 23, 2002
Simplify DLL-encapsulated administrative functions
Many common administrative functions in Windows are encapsulated in DLLs. This design lets multiple executable programs share certain functions but prevents users from directly executing functions that DLLs contain. Fortunately, Windows provides a command-line utility, Rundll32, that lets you execute some DLL functions. Here are 10 Rundll32 shortcuts to common administrative functions.
10. Open Microsoft Internet Explorer (IE) to a specific Web site. For example, to launch IE and open the Windows & .NET Magazine Web site, simply enter the following command:
rundll32.exe url.dll,FileProtocolHandler http://www.winnetmag.com
9. Add a printer to a remote computer. Rundll32 can launch the Add Printer Wizard for a local or remote computer. The following example starts the Add Printer Wizard for remote computer teca4. (To start the Add Printer Wizard for a local computer, omit the /c switch.)
rundll32.exe printui.dll,PrintUIEntry /il /c\teca4
8. Add printer ports for attached TCP/IP printers. The following command starts the Add TCP/IP Printer Port Wizard:
rundll32.exe tcpmonui.dll,LocalAddPortUI
7. Start the Network Identification Wizard. The following command starts the wizard, which steps you through your initial networking setup and lets you specify the computer name, logon domain, logon ID, and password:
rundll32.exe netplwiz.dll,NetAccWizRunDll
6. Run the Network Place Wizard. This wizard lets you add a link to a network storage location. The link can access a network share, an FTP location, or a Web folder. Enter this command to start the wizard:
rundll32.exe netplwiz.dll,AddNetPlaceRunDll
5. Create a new shared folder. Another handy administrative function that Rundll32 can perform is launching the New Share dialog box, which lets you graphically add network shares. Simply enter the following command:
rundll32.exe ntlanui.dll,ShareCreate
4. Manage network shares. Use the following command to launch the Shared Directories dialog box. You can use this dialog box to list your system's network shares, add a new share, toggle sharing on and off, and change share permissions:
rundll32.exe ntlanui.dll,ShareManage
3. Launch Device Manager. To quickly run Device Manager without first navigating through the Administrative Tools folder, run Rundll32 as follows:
rundll32.exe devmgr.dll DeviceManager_Execute
2. Lock your workstation. Rundll32 can also perform various shell functions. For example, you can add an icon to your desktop that you can use to immediately lock your workstation. To do so, right-click on the desktop and select New, Shortcut. In the Command line text box, enter the command
rundll32.exe user32.dll,LockWorkStation
1. Automatically log off a user or shut down your machine. You can incorporate Rundll32 into your Windows Script Host (WSH) or command-shell scripts to log off the current user or shut down and restart the computer. The value in the command's last parameter controls the action that will occur: 0 performs a logoff, 1 performs a shutdown, 2 performs a reboot, 4 performs a forced shutdown, and 8 powers down the machine. The following example performs a logoff:
rundll32.exe shell32.dll,SHExitWindowsEx 0
Corrections to this Article:
Correction for July 2002 Top Ten Column:Tip #1 of the Top 10 column published in July 2002 was incorrect. As published, the tip to shut down Windows only works for Windows 98/ME systems. The original tip was as follows:
rundll32.exe Shell32.dll, SHExitWindowsEX 0
This tip doesn’t work for Windows NT/2000/XP. To shut down an NT system from the command line using the rundll32 utility, you can enter the following command:
RUNDLL32 USER32.DLL,ExitWindowsEx
Unfortunately this tip doesn’t work for Win2K/XP. To shut down Win2K, you need to use either the shutdown.exe utility that’s provided in the Resource Kit or, if you don’t have the Resource kit, you can download and use the freeware psShutdown utility from Sysinternals (http://www.systernals.com). The psShutdown utility can be found at the following URL:http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtmlXP incorporates the shutdown command into its native command set so to shut down an XP system, you can simply enter the shutdown command at the command prompt.Windows Script Host (WSH) scripting also provides another method of shutting down a Win2K/XP system. An example WSH script to shut down the system follows:
'WSHShutdown.vbsSet OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select *from Win32_OperatingSystem where Primary=true")for each OpSys in OpSysSet OpSys.ShutDown()next
About the Author
You May Also Like