Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase

Running Control Panel Applets

 Keywords:  NT 95 98 ME 2000 Control Panel Applet command line launching IgnoreInput BlockInput

The following are valid control panel property page and wizard launch statements that will initiate the various control panel applets, and may also include the ability to specify the active tab on multiple-tabbed property pages. Some systems may not have all the control panel applets or related applications installed; on those systems executing the statement produce no result.

To immediately test the desired statement, use the Windows Run command from the Start Menu, and paste in the code line below. In WinBatch, use the RUN function or similar routine to launch the control panel app. Maintaining commas, spaces and special characters is extremely important, so take care when pasting into a string into your WinBatch script.

Rundll32.exe is used extensively by Windows to launch a wide variety of actions defined in DLLs. One of its many capabilities is invoking Control Panel applets. A file with the .cpl extension contains one or more applets, and some of the applets may display multiple pages. Using Rundll32.exe, you can launch any of the applets found in a CPL file, and in many cases you can cause the applet to open on a particular page. The basic syntax is:

To select a particular applet within the file, append a comma, an @ sign, and the zero-based number of the applet. For example, to launch the keyboard applet, which is the second applet within Main.cpl, you would use this command:

If the CPL file does not contain an applet matching the number you've passed, nothing will happen. Thus you can identify the applets within a CPL file empirically by repeating this command from a Windows command prompt, ending with @0, @1, @2, and so on.

Some multipage applets are designed so that they can be opened at a particular page. To do so, you must specify the applet number (@0 for a single-applet file). Then append a comma and the page number. The Microsoft Knowledge Base says that the page number, if supported, is 1-based, but a bit of experimenting shows that some are 0-based. This command line launches the Display Properties dialog and opens to the Appearance page (the third page; number two in a zero-based scheme):

Again, it's very simple to experiment with these possibilities at a Windows command prompt. Once you've determined the correct command to invoke the applet you want, you can use that command in a Winbatch script.

Control.exe is a utility that is included with Windows 95, Windows 98, Windows NT 4.0, and Windows 2000 that launches Control Panel applications. Applications can use the following command line to start a Control Panel applet:
control.exe mycontrol.cpl 
This starts the first control panel applet in Mycontrol.cpl. If you have multiple Control Panel applets in Mycontrol.cpl, you need to add to the following line exactly as shown:
Control.exe mycontrol.cpl,@1
@1 specifies the second (zero-based) applet in the .cpl file. If you don't specify this parameter, @0 is used by default.

The final (optional) parameter serves as the command line parameters passed to the Control Panel applet in the CPL_STARTWPARM notification. For example, some of the system's Control Panel applets take the page number (one based, not zero based) as the command line parameter. For example, if you want to start the Add/Remove Programs applet from the Windows Setup page so you can instruct the user to add extra system components, you can use this code:

   Control.exe appwiz.cpl,@0,2
The Control.exe application recognizes special names for commonly-used Control Panel applications. Use these names instead of launching the corresponding .cpl file directly. If there is a special name available, it should be listed below.

For the actual Window commandlines see the article Windows Control Panel Commandline

Examples of Running Control Panel Applets:

Make sure your statement is all on one line, and case can count..... The string "Control_RunDLL" is case sensitive.

;32bit ODBC 
Run("rundll32.exe", "shell32.dll,Control_RunDLL odbccp32.cpl") *or* Run("control.exe", "odbccp32.cpl") ;Add New Hardware
Run("rundll32.exe", "shell32.dll,Control_RunDLL sysdm.cpl,Add New Hardware") *or* Run("control.exe", "sysdm.cpl,Add New Hardware") ;Accessibility Properties
Run("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl") *or* Run("control.exe", "access.cpl") ;Add/Remove Programs
Run("rundll32.exe", "shell32.dll,Control_RunDLL appwiz.cpl") *or* Run("control.exe", "appwiz.cpl") ;Briefcase
; creates a NEW Briefcase on the desktop Run("rundll32.exe", "syncui.dll,Briefcase_Create") ;Date/Time
Run("rundll32.exe", "shell32.dll,Control_RunDLL timedate.cpl") *or* Run("control.exe", "timedate.cpl") *or* Run("control.exe", "date/time") ;Copy Disk Dialog
; displays the Copy Disk Dialog for removable media Run("rundll32.exe", "diskcopy.dll,DiskCopyRunDll") ;Display / Desktop
Run("rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl") *or* Run("control.exe", "desk.cpl") *or* Run("control.exe","desktop") *or* ; Launches the Desktop Display Control Panel subprogram, with the Appearance tab preselected. Run("control.exe","color") ;Dialup Network wizard
Run("rundll32.exe"," rnaui.dll,RnaWizard") TIP: How to start Windows 95 Dial-up Networking directly: Here's how to open the Dialup-networking window directly with SID (system ID): Run("C:\WINDOWS\EXPLORER.EXE","::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{992CFFA0-F557-101A-88EC-00DD010CCC48}") ;Launch a specific Connectoid
Run("rundll32.exe"," rnaui.dll,RnaDial {Connectoid}") *OR* Run("rasdial.exe","Connectoid") ;Fonts
Run("rundll32.exe", "shell32.dll,Control_RunDLL main.cpl,Fonts") *or* Run("control.exe", "main.cpl,Fonts") *or* Run("control.exe","Fonts") ;Keyboard
Run("rundll32.exe", "shell32.dll,Control_RunDLL main.cpl,Keyboard") *or* Run("control.exe", "main.cpl,@1") *or* Run("control.exe","Keyboard") ;Internet Properties
Run("rundll32.exe", "shell32.dll,Control_RunDLL INETCPL.CPL") *or* Run("control.exe", "INETCPL.CPL") ;Mail and Fax
Run("rundll32.exe", "shell32.dll,Control_RunDLL mlcfg32.cpl") *or* Run("control.exe", "mlcfg32.cpl") ;Microsoft Mail Postoffice
Run("rundll32.exe", "shell32.dll,Control_RunDLL wgpocpl.cpl") *or* Run("control.exe", "wgpocpl.cpl") ;Modems
Run("rundll32.exe", "shell32.dll,Control_RunDLL modem.cpl") *or* Run("control.exe", "modem.cpl") ;Mouse
Run("rundll32.exe", "shell32.dll,Control_RunDLL main.cpl") *or* Run("control.exe", "main.cpl") *or* Run("control.exe","mouse") ;Multimedia
Run("rundll32.exe", "shell32.dll,Control_RunDLL mmsys.cpl") *or* Run("control.exe", "mmsys.cpl") ;95 Network
Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl") *or* Run("control.exe", "netcpl.cpl") ;NT Network
Run("rundll32.exe", "shell32.dll,Control_RunDLL ncpa.cpl") *or* Run("control.exe", "ncpa.cpl") ;ODBC
Run("rundll32.exe", "shell32.dll,Control_RunDLL odbcinst.dll") ;Passwords
Run("rundll32.exe", "shell32.dll,Control_RunDLL password.cpl") *or* Run("control.exe", "password.cpl") ;Printers
Run("rundll32.exe", "shell32.dll,Control_RunDLL main.cpl,Printers") *or* Run("control.exe", "Printers") ;Regional Settings
Run("rundll32.exe", "shell32.dll,Control_RunDLL intl.cpl") *or* Run("control.exe", "intl.cpl") *or* Run("control.exe","international") ;Sounds
Run("rundll32.exe", "shell32.dll,Control_RunDLL mmsys.cpl,Sounds") *or* Run("control.exe", "mmsys.cpl,Sounds") ;System
Run("rundll32.exe", "shell32.dll,Control_RunDLL sysdm.cpl") *or* Run("control.exe", "sysdm.cpl") ;Open AddPrinters window
Run("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter") ;Open Printers folder
Run("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder") *or* Run("control.exe","printers") ;Open Map Network Drive window
Run("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL Connect") ;Open Disconnect Network Drive window
Run("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL Disconnect") ;Open Fonts Folder
Run("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL FontsFolder") ;Format drive
Run("rundll32.exe", "shell32.dll,SHFormatDrive")

NT specific Control Panel Applets:

Run("rundll32.exe","shell32.dll,Control_RunDLL console.cpl,Console")

Run("rundll32.exe","shell32.dll,Control_RunDLL devapps.cpl,@0")

Devices tool start...
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,@2")
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,Devices")

Run("rundll32.exe","shell32.dll,Control_RunDLL ports.cpl")

Run("rundll32.exe","shell32.dll,Control_RunDLL devapps.cpl,@1")

Server tool start... 
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,@0")
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,Server")

Services tool start...
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,@1")
Run("rundll32.exe","shell32.dll,Control_RunDLL srvmgr.cpl,Services")

Tape Devices 
Run("rundll32.exe","shell32.dll,Control_RunDLL devapps.cpl,@2")

Run("rundll32.exe","shell32.dll,Control_RunDLL telephon.cpl")

Run("rundll32.exe","shell32.dll,Control_RunDLL ups.cpl,UPS")                              

For Windows 2000 and later systems:

; Launches the Folder Settings Control Panel subprogram.

; Launches the Novell NetWare Control Panel subprogram (if installed).

; Launches the Phone and Modem Options Control Panel subprogram.

; Displays the Administrative Tools folder.

; Displays the Scheduled Tasks folder.

; Displays the Network and Dial-Up Connections folder.

; Launches the Infrared Control Panel subprogram (if installed).

; Launches the Users and Passwords Control Panel subprogram.

For Windows XP and later systems:

; Launches the Net Connection Wizard Control Panel subprogram.

Article ID:   W14617
Filename:   Running Control Panel Applets.txt