Detailed Explanation of RUNDLL.exe Command (Repost)
Friends who often use Windows 9x must be familiar with the two files Rundll32.exe and Rundll.exe. However, since the functions of these two programs were originally only for internal use within Microsoft, there must be very few friends who really know how to use them. Well, if you are not clear about it, then let me tell you.
First of all, please do a small experiment (please save the results of the program you are running in advance, otherwise...): Click "Start - Programs - Ms-Dos Mode" to enter the Dos window, then type "rundll32.exe user.exe,restartwindows", and then press the Enter key. At this time, you will see that the computer is restarted! How about it, is it interesting?
Of course, the function of Rundll is not just to restart your computer. In fact, Rundll, as the name suggests, executes Dll. Its function is to call the Windows dynamic link library in the command line. The difference between Rundll32.exe and Rundll.exe is that the former calls 32-bit link libraries, and the latter is used for 16-bit link libraries. Their command format is:
RUNDLL.EXE <DLL name>,<entry point>
Three points should be noted here: 1. There should be no spaces in the Dll file name. For example, if the file is located in the c:\Program Files\ directory, you need to change this path to c:\Progra~1\; 2. The comma between the Dll file name and the Dll entry point cannot be omitted, otherwise the program will be wrong and no information will be given! 3. This is the most important point: Rundll cannot be used to call Dlls containing return value parameters, such as GetUserName(), GetTextFace() in Win32API. In Visual Basic, there is an instruction Shell for executing external programs, and the format is:
Shell "command line"
If you can use the Shell instruction well with Rundll32.exe, it will make your VB program have effects that are difficult or even impossible to achieve with other methods: still taking restart as an example, the traditional method requires you to first create a module in the VB project, then write the declaration of WinAPI, and finally call it in the program. But now it's done with just one sentence: Shell "rundll32.exe user.exe,restartwindows"! Isn't it much more convenient?
In fact, Rundll32.exe has unique advantages in calling various Windows control panels and system options. Next, I will list the relevant Rundll commands I collected on the Internet as follows (very useful, it can save you a lot of time in calling Windows API!!), for everyone to refer to in programming:
Command line: rundll32.exe shell32.dll,Control_RunDLL
Function: Display the control panel
Command line: rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1
Function: Display the "Control Panel - Accessibility Options - Keyboard" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2
Function: Display the "Control Panel - Accessibility Options - Sound" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3
Function: Display the "Control Panel - Accessibility Options - Display" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4
Function: Display the "Control Panel - Accessibility Options - Mouse" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5
Function: Display the "Control Panel - Accessibility Options - Legacy" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl @1
Function: Execute the "Control Panel - Add New Hardware" wizard.
Command line: rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter
Function: Execute the "Control Panel - Add New Printer" wizard.
Command line: rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,1
Function: Display the "Control Panel - Add/Remove Programs - Install/Uninstall" panel.
Command line: rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
Function: Display the "Control Panel - Add/Remove Programs - Install Windows" panel.
Command line: rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3
Function: Display the "Control Panel - Add/Remove Programs - Startup Disk" panel.
Command line: rundll32.exe syncui.dll,Briefcase_Create
Function: Create a new "My Briefcase" on the desktop.
Command line: rundll32.exe diskcopy.dll,DiskCopyRunDll
Function: Display the disk copying window
Command line: rundll32.exe apwiz.cpl,NewLinkHere %1
Function: Display the "Create Shortcut" dialog box, and the location of the created shortcut is determined by the %1 parameter.
Command line: rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,0
Function: Display the "Date and Time" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,1
Function: Display the "Time Zone" option window.
Command line: rundll32.exe rnaui.dll,RnaDial [name of a certain dial-up connection]
Function: Display the dial-up window of a certain dial-up connection. If a dial-up connection has been made, display the window of the current connection status.
Command line: rundll32.exe rnaui.dll,RnaWizard
Function: Display the window of the "New Dial-up Connection" wizard.
Command line: rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
Function: Display the "Display Properties - Background" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1
Function: Display the "Display Properties - Screen Saver" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
Function: Display the "Display Properties - Appearance" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3
Function: Display the "Display Properties - Properties" option window.
Command line: rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder
Function: Display the "Fonts" folder of Windows.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @3
Function: Also display the "Fonts" folder of Windows.
Command line: rundll32.exe shell32.dll,SHformatDrive
Function: Display the format disk dialog box.
Command line: rundll32.exe shell32.dll,Control_RunDLL joy.cpl,,0
Function: Display the "Control Panel - Game Controllers - General" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL joy.cpl,,1
Function: Display the "Control Panel - Game Controllers - Advanced" option window.
Command line: rundll32.exe mshtml.dll,PrintHTML (HTML document)
Function: Print the HTML document.
Command line: rundll32.exe shell32.dll,Control_RunDLL mlcfg32.cpl
Function: Display the Microsoft Exchange general options window.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @0
Function: Display the "Control Panel - Mouse" option.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @1
Function: Display the "Control Panel - Keyboard Properties - Speed" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @1,,1
Function: Display the "Control Panel - Keyboard Properties - Language" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @2
Function: Display the Windows "Printers" folder.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @3
Function: Display the Windows "Fonts" folder.
Command line: rundll32.exe shell32.dll,Control_RunDLL main.cpl @4
Function: Display the "Control Panel - Input Method Properties - Input Method" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL modem.cpl,,add
Function: Execute the "Add New Modem" wizard.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
Function: Display the "Control Panel - Multimedia Properties - Audio" property page.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
Function: Display the "Control Panel - Multimedia Properties - Video" property page.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
Function: Display the "Control Panel - Multimedia Properties - MIDI" property page.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3
Function: Display the "Control Panel - Multimedia Properties - CD Music" property page.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,4
Function: Display the "Control Panel - Multimedia Properties - Devices" property page.
Command line: rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1
Function: Display the "Control Panel - Sound" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL netcpl.cpl
Function: Display the "Control Panel - Network" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl
Function: Display the ODBC32 Data Source Administrator option window.
Command line: rundll32.exe shell32.dll,OpenAs_RunDLL{drive:\path\filename}
Function: Display the "Open With" dialog box for the specified file (drive:\path\filename).
Command line: rundll32.exe shell32.dll,Control_RunDLL password.cpl
Function: Display the "Control Panel - Password" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl
Function: Display the "Control Panel - Power Management Properties" option window.
Command line: rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder
Function: Display the Windows "Printers" folder. (Same as rundll32.exe shell32.dll,Control_RunDLL main.cpl @2)
Command line: rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
Function: Display the "Control Panel - Regional Options Properties - Regional Settings" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
Function: Display the "Control Panel - Regional Options Properties - Numbers" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
Function: Display the "Control Panel - Regional Options Properties - Currency" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
Function: Display the "Control Panel - Regional Options Properties - Time" option window.
Command line: rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4
Function: Display the "Control Panel - Regional Options Properties - Date" option window.
Command line: rundll32.exe desk.cpl,InstallScreenSaver [screen saver file name]
Function: Set the specified screen saver file as the Windows screen saver and display the screen saver properties window.
Command line: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,0
Function: Display the "Control Panel - System Properties - Legacy" property window.
Command line: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
Function: Display the "Control Panel - System Properties - Device Manager" property window.
Command line: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
Function: Display the "Control Panel - System Properties - Hardware Profiles" property window.
Command line: rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
Function: Display the "Control Panel - System Properties - Performance" property window.
Command line: rundll32.exe user.exe,restartwindows
Function: Forcefully close all programs and restart the computer.
Command line: rundll32.exe user.exe,exitwindows
Function: Forcefully close all programs and shut down the computer.
Command line: rundll32.exe shell32.dll,Control_RunDLL telephon.cpl
Function: Display the "Dial-up Properties" option window
Command line: rundll32.exe shell32.dll,Control_RunDLL themes.cpl
Function: Display the "Desktop Themes" option panel
Of course, not only Visual Basic, but also other programming languages such as Delphi, Visual C++ can use these functions of Rundll by calling external commands. The specific methods will not be described in detail here. Flexibly using Rundll will definitely make your programming easy and achieve twice the result with half the effort! The above content is taken from "Programming Technology"