Export (0) Print
Expand All

Executing Control Panel Items

There are two ways to start a Control Panel item:

  • The user can open Control Panel and start an item by clicking or double-clicking the item's icon.
  • The user or an application can start a Control Panel item by executing it directly from the command line prompt.

An application can open the Control Panel programmatically by using the WinExec function.


WinExec("c:\windows\system32\control.exe", SW_NORMAL);

The following example shows how an application can start the Control Panel item named MyCpl.cpl by using the WinExec function.


WinExec("c:\windows\system32\control.exe MyCpl.cpl", SW_NORMAL);

When a Control Panel item is opened through a command line, you can instruct it to open to a particular tab in the item. Note that due to the addition and removal of certain tabs in some Windows Vista Control Panel items, the numbering of the tabs might have changed from that in Microsoft Windows XP. For instance, the following example launches the fourth tab in the System item on Windows XP and the third tab on Windows Vista.


control.exe sysdm.cpl,,3

This topic discusses the following:

Windows Vista Canonical Names

In Windows Vista, the preferred method of launching a Control Panel item from a command line is to use the Control Panel item's canonical name. A canonical name is a non-localized string that the Control Panel item declares in the registry. The value of using a canonical name is that it abstracts the module name of the Control Panel item. An item can be implemented in a .dll and later be reimplemented as a .exe or change its module name. As long as the canonical name remains the same, then any program that opens it by using that canonical name does not need to be updated to account for the changes.

By convention, the canonical name is "CorporationName.ControlPanelItemName".

The following example shows how an application can start the Control Panel item Windows Update with WinExec.


WinExec("%systemroot%\system32\control.exe /name Microsoft.WindowsUpdate", SW_NORMAL);

    To start a Control Panel item with its canonical name, use: "%systemroot%\system32\control.exe /name canonicalName"

    To open a specific sub-page in an item, or to open it with additional parameters, use: "%systemroot%\system32\control.exe /name canonicalName /page pageName"

    An application can also implement the IOpenControlPanel interface to start Control Panel items, including the ability to open a specific sub-page, though the IOpenControlPanel::Open method.

    The following canonical names are defined for Control Panel items on Windows Vista. Not all Control Panel items are available on all varieties of Windows Vista and some Control Panel items may appear only when appropriate hardware is detected. These canonical names do not change for different languages. They are always in English, even if the system's language is non-English.

    • Microsoft.AddHardware
    • Microsoft.AdministrativeTools
    • Microsoft.AudioDevicesAndSoundThemes
    • Microsoft.AutoPlay
    • Microsoft.BackupAndRestoreCenter
    • Microsoft.BitLockerDriveEncryption
    • Microsoft.Bluetooth
    • Microsoft.CardSpace
    • Microsoft.ColorManagement
    • Microsoft.DateAndTime
    • Microsoft.DefaultPrograms
    • Microsoft.DeviceManager
    • Microsoft.EaseOfAccessCenter
    • Microsoft.FolderOptions
    • Microsoft.Fonts
    • Microsoft.GameControllers
    • Microsoft.GetPrograms
    • Microsoft.GetProgramsOnline
    • Microsoft.IndexingOptions
    • Microsoft.Infrared
    • Microsoft.InternetOptions
    • Microsoft.iSCSIInitiator
    • Microsoft.Keyboard
    • Microsoft.MobilityCenter
    • Microsoft.Mouse
    • Microsoft.NetworkAndSharingCenter
    • Microsoft.OfflineFiles
    • Microsoft.ParentalControls
    • Microsoft.PenAndInputDevices
    • Microsoft.PeopleNearMe
    • Microsoft.PerformaceInformationAndTools
    • Microsoft.Personalization
    • Microsoft.PhoneAndModemOptions
    • Microsoft.PowerOptions
    • Microsoft.Printers
    • Microsoft.ProblemReportsAndSolutions
    • Microsoft.ProgramsAndFeatures
    • Microsoft.RegionalAndLanguageOptions
    • Microsoft.ScannersAndCameras
    • Microsoft.SecurityCenter
    • Microsoft.SpeechRecognitionOptions
    • Microsoft.SyncCenter
    • Microsoft.System
    • Microsoft.TabletPCSettings
    • Microsoft.TaskbarAndStartMenu
    • Microsoft.TextToSpeech
    • Microsoft.UserAccounts
    • Microsoft.WelcomeCenter
    • Microsoft.WindowsAnytimeUpgrade
    • Microsoft.WindowsDefender
    • Microsoft.WindowsFirewall
    • Microsoft.WindowsSideShow
    • Microsoft.WindowsSidebarProperties
    • Microsoft.WindowsUpdate

    New Commands for Windows Vista

    On Windows Vista, some options that were accessed by a .cpl module on Windows XP are now implemented as .exe files. This provides added security by allowing standard users to be prompted to provide administrator credentials when trying to launch the files. Options that do not require extra security are accessed by the same command lines that were used in Windows XP. The following is a list of commands used in Windows Vista to access specific tabs of Control Panel items:

    Personalization

    • Font size and DPI: %windir%\system32\DpiScaling.exe
    • Screen resolution: %windir%\system32\control.exe desk.cpl,Settings,@Settings
    • Display settings: %windir%\system32\control.exe desk.cpl,Settings,@Settings
    • Themes: %windir%\system32\control.exe desk.cpl,Themes,@Themes
    • Screensaver: %windir%\system32\control.exe desk.cpl,screensaver,@screensaver
    • Multi-monitor: %windir%\system32\control.exe desk.cpl,Monitor,@Monitor
    • Color Scheme: %windir%\system32\control.exe /name Microsoft.Personalization /page pageColorization
    • Desktop background: %windir%\system32\control.exe /name Microsoft.Personalization /page pageWallpaper

    System

    • Performance: %windir%\system32\SystemPropertiesPerformance.exe
    • Remote access: %windir%\system32\SystemPropertiesRemote.exe
    • Computer name: %windir%\system32\SystemPropertiesComputerName.exe
    • System protection: %windir%\system32\SystemPropertiesProtection.exe
    • Advanced system properties: %windir%\system32\SystemPropertiesAdvanced.exe

    Programs and Features

    • Add or remove programs: %windir%\system32\control.exe /name Microsoft.ProgramsAndFeatures
    • Windows features: %windir%\system32\OptionalFeatures.exe

    Regional and Language Options

    • Keyboard: %systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:"keyboard"
    • Location: %systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:"location"
    • Administrative: %systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:"administrative"

    Folder Options

    • Folder searching: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 2
    • File extension associations: %windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageFileAssoc
    • View: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 7
    • General: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 0

    Power Options

    • Edit current plan settings: %windir%\system32\control.exe /name Microsoft.PowerOptions /page pagePlanSettings
    • System settings: %windir%\system32\control.exe /name Microsoft.PowerOptions /page pageGlobalSettings
    • Create a power plan: %windir%\system32\control.exe /name Microsoft.PowerOptions /page pageCreateNewPlan
    • There is no canonical command for the Advanced Settings page, it is accessed in the older manner: %windir%\system32\control.exe powercfg.cpl,,3

    Legacy Control Panel Commands

    When you use the WinExec function, the system can recognize special Control Panel commands. These commands predate Windows Vista.

    control.exe desktopLaunches the Display Properties window.
    control.exe colorLaunches the Display Properties window with the Appearance tab preselected.
    control.exe date/timeLaunches the Date and Time Properties window.
    control.exe internationalLaunches the Regional and Language Options window.
    control.exe mouseLaunches the Mouse Properties window.
    control.exe keyboardLaunches the Keyboard Properties window.
    control.exe printersDisplays the Printers and Faxes folder.
    control.exe fontsDisplays the Fonts folder.

    For Windows 2000 and later systems:

    control.exe foldersLaunches the Folder Options window.
    control.exe netwareLaunches the Novell NetWare window (if installed).
    control.exe telephonyLaunches the Phone and Modem Options window.
    control.exe admintoolsDisplays the Administrative Tools folder.
    control.exe schedtasksDisplays the Scheduled Tasks folder.
    control.exe netconnectionsDisplays the Network Connections folder.
    control.exe infraredLaunches the Infrared Monitor window (if installed).
    control.exe userpasswordsLaunches the User Accounts window.

    Related Topics

    Community Additions

    Show:
    © 2014 Microsoft