EN
Данное содержимое не доступно на вашем языке, используйте версию на английском языке.

Executing Control Panel Items

Note  If you're looking for the list of canonical and module names for Control Panel items, for use with group policy or the functions and methods discussed in this topic, see Canonical Names of Control Panel Items.

There are many ways to open a Control Panel item, including these:

  • The user can open Control Panel and double-click the item's icon.
  • The user can issue a Control.exe instruction from the command line.
  • Control Panel items and options that are implemented as .exe files can be launched directly.
  • Control Panel items that are implemented as .dll files can be launched through Rundll32.exe.
  • An app can programmatically open a Control Panel item.

In this topic, we discuss using Control.exe and the IOpenControlPanel::Open method. We also go over some of the many commands that can be used to access pages and options within a particular Control Panel item.

Canonical Names for Control Panel Items

As of Windows Vista, the recommended method for specifying a Control Panel item in a launch command is through its canonical name. A canonical name is a non-localized string that the Control Panel item declares in the registry. The main benefit of a canonical name in this case is that the item's underlying implementation can be changed, such as switching from a .cpl to a .dll format or changing the module's name, without requiring an update to any caller's code. Also, when a canonical name itself is changed, the old name can be mapped to the new name so that, again, older code doesn't need to be updated.

By convention, the canonical name is formed as CorporationName.ControlPanelItemName. Control Panel items included with Windows use the form Microsoft.ControlPanelItemName.

For a complete list of Control Panel item canonical names, see Canonical Names of Control Panel Items.

Opening a Control Panel item programmatically with IOpenControlPanel

In code, your app can use the system-supplied implementation of the IOpenControlPanel::Open method to launch a Control Panel item, optionally opening it to a specific page.

This example shows a few calls to the Open method. Note that when a page number is used instead of a page name, it still has to be passed as a string.



HRESULT hr = S_OK;

hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (SUCCEEDED(hr))
{
    IOpenControlPanel *pocp;

    hr = CoCreateInstance(CLSID_OpenControlPanel, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pocp));
    if (SUCCEEDED(hr))
    {
        hr = pocp->Open(L"Microsoft.DateAndTime", NULL, NULL);
        if (SUCCEEDED(hr))
        {
            // ...
        }

        hr = pocp->Open(L"Microsoft.DateAndTime", L"1", NULL);
        if (SUCCEEDED(hr))
        {
            // ...
        }

        hr = pocp->Open(L"Microsoft.CredentialManager", L"?SelectedVault=CredmanVault", NULL);
        if (SUCCEEDED(hr))
        {
            // ...
        }

        hr = pocp->Open(L"Microsoft.ActionCenter", L"pageSettings", NULL);
        if (SUCCEEDED(hr))
        {
            // ...
        }

        pocp->Release();
    }
}

Opening a Control Panel item from the command line with Control.exe

You can use the Control.exe file to launch a Control Panel item from the command line. Here are its general forms.


CONTROL [cpl]
CONTROL [cpl],,[page]
CONTROL [/name] [/page]
CONTROL [-name] [-page]

When you issue the command with no arguments, it launches the Control Panel itself, using the user's last view setting (category, small icons, or large icons).

Either a forward slash or a dash precedes the optional name and page arguments. Both arguments can be enclosed in optional quotation marks ("Microsoft.System"). You generally need quotation marks only if you're providing a full path that includes spaces.

The name argument can be expressed as:

  • A canonical name (preferred).
  • A .cpl file name, including the extension, with or without its path, as necessary.

In the case of an unrecognized name argument, Control.exe fails silently, simply returning you to the command prompt without comment and without launching anything.

Supply the page argument as either a page name or, in the case of tabbed windows, a zero-based tab number. The arrangement of pages can change from release to release (though in practice they don't change often); use caution in relying on a particular page always having the same number. Also be aware that not all Control Panel items respond to the page argument. Page names for those items that use them are listed in the Canonical Names of Control Panel Items topic.

Here are a few examples of Control.exe commands.



control
control.exe

control timedate.cpl
control "%SystemRoot%\system32\timedate.cpl"

control /name Microsoft.DateAndTime
control /name "Microsoft.DateAndTime"
control -name Microsoft.DateAndTime

control /name Microsoft.DateAndTime /page 1
control -name "Microsoft.DateAndTime" -page "1"
control -name Microsoft.DateAndTime -page 1

Directly launchable Control Panel options

Some options within individual Control Panel items are implemented through separate .exe files rather than as pages. Additionally, some older options no longer have a direct access path through the Control Panel even though they are still valid.

Here's a list of commands you can use to access specific pages, windows, or options.

Action Center

  • Check for solutions to problems: %windir%\system32\rundll32.exe werconcpl.dll,LaunchErcApp -updatecheck
  • Choose when to be notified about changes to your computer: %windir%\system32\UserAccountControlSettings.exe

Administrative Tools

  • Disk Cleanup: %windir%\system32\cleanmgr.exe
  • Disk Defragmenter: %windir%\system32\dfrgui.exe
  • iSCSI Initiator Properties: %windir%\system32\iscsicpl.exe
  • Windows Memory Diagnostic: %windir%\system32\mdsched.exe
  • Local Certificates Folder: %windir%\system32\mmc.exe %windir%\system32\certlm.msc
  • Disk Management: %windir%\system32\mmc.exe %windir%\system32\diskmgmt.msc
  • Event Viewer: %windir%\system32\mmc.exe %windir%\system32\eventvwr.msc
  • Local Group Policy Editor: %windir%\system32\mmc.exe %windir%\system32\gpedit.msc
  • Local Services: %windir%\system32\mmc.exe %windir%\system32\services.msc
  • Task Scheduler: %windir%\system32\mmc.exe %windir%\system32\taskschd.msc
  • Task Scheduler: %windir%\system32\control.exe schedtasks
  • ODBC Data Source Administrator (32 or 64-bit): %windir%\system32\odbcad32.exe
  • Performance Monitor: %windir%\system32\perfmon.exe
  • Generate a System Diagnostics Report: %windir%\system32\perfmon.exe /report

Color Management

  • Color Management: %windir%\system32\colorcpl.exe

Devices and Printers

  • Scanners and Cameras: "%ProgramFiles%\Windows Photo Viewer\ImagingDevices.exe"
  • Add a Device: %windir%\system32\DevicePairingWizard.exe
  • Device Installation Settings: %windir%\system32\rundll32.exe newdev.dll,DeviceInternetSettingUi 5
  • Add a Printer: %windir%\system32\rundll32.exe printui.dll,PrintUIEntry /il
  • Game Controllers: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\joy.cpl
  • Windows Fax and Scan: %windir%\system32\wfs.exe

Display

  • Clear Type Text Tuner: %windir%\system32\cttune.exe
  • Display Color Calibration: %windir%\system32\dccw.exe
  • Desktop Icon Settings: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0

Ease of Access

  • Narrator Settings: %windir%\system32\narrator.exe

File History

  • File History: %windir%\system32\FileHistory.exe

Folder Options

  • Folder Search Options: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 2
  • Folder View Options: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 7

Fonts

  • Private Character Editor: %windir%\system32\eudcedit.exe

Internet Options

  • Connect to the Internet: %windir%\system32\xwizard.exe RunWizard {7071ECA0-663B-4bc1-A1FA-B97F3B917C55}

Network and Sharing Center

  • Windows Network Diagnostics: %windir%\system32\Rundll32.exe ndfapi,NdfRunDllDiagnoseIncident
  • Create a Dial-Up Connection: %windir%\system32\xwizard.exe RunWizard {7071EC71-663B-4bc1-A1FA-B97F3B917C55}
  • Create a VPN Connection: %windir%\system32\xwizard.exe RunWizard {7071EC75-663B-4bc1-A1FA-B97F3B917C55}
  • Set Up a Connection or Network: %windir%\system32\xwizard.exe RunWizard {7071ECE0-663B-4bc1-A1FA-B97F3B917C55}
  • Create a Broadband Connection: %windir%\system32\xwizard.exe RunWizard {C03E8585-781E-49a1-8190-CE902D0B2CE7}
  • View Network Connections: %windir%\system32\control.exe netconnections

Personalization

  • Screen Resolution: %windir%\system32\control.exe desk.cpl,Settings,@Settings
  • Installed Themes: %windir%\system32\control.exe desk.cpl,Themes,@Themes
  • Screen Saver Settings: %windir%\system32\control.exe desk.cpl,screensaver,@screensaver

Power Options

  • Advanced Settings: %windir%\system32\control.exe powercfg.cpl,,3

Programs and Features

  • Program Compatibility Troubleshooter: %windir%\system32\msdt.exe -id PCWDiagnostic -ep ControlPanelSearch
  • Turn Windows Features On and Off: %windir%\system32\OptionalFeatures.exe

RemoteApp and Desktop Connections

  • Access RemoteApp and desktops: %windir%\system32\xwizard.exe RunWizard {7940ACF8-60BA-4213-A7C3-F3B400EE266D}

Sound

  • Volume Mixer: %windir%\system32\sndvol.exe

Speech Recognition

  • Speech Recognition Voice Training: %windir%\system32\rundll32.exe %windir%\system32\speech\speechux\SpeechUX.dll,RunWizard UserTraining
  • Start or Set Up Speech Recognition: %windir%\speech\common\sapisvr.exe -SpeechUX
  • Microphone Setup Wizard: %windir%\system32\rundll32.exe %windir%\system32\speech\speechux\SpeechUX.dll,RunWizard MicTraining
  • Speech Recognition Tutorial: %windir%\system32\rundll32.exe %windir%\system32\speech\speechux\SpeechUX.dll,RunWizard Tutorial
  • Text to Speech Settings: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\speech\speechux\sapi.cpl

Sync Center

  • Manage Offline Files, General: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\cscui.dll
  • Manage Offline Files, Disk Usage: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\cscui.dll,1
  • Manage Offline Files, Encryption: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\cscui.dll,2
  • Manage Offline Files, Network: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL %windir%\system32\cscui.dll,3

System

  • Windows Remote Assistance, Invite someone you trust to help you: %windir%\system32\msra.exe
  • Create a Recovery Drive: %windir%\system32\RecoveryDrive.exe
  • Edit User's Environment Variables: %windir%\system32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
  • User Profiles: %windir%\system32\rundll32.exe sysdm.cpl,EditUserProfiles
  • System Properties, Advanced: %windir%\system32\SystemPropertiesAdvanced.exe
  • System Properties, Computer Name: %windir%\system32\SystemPropertiesComputerName.exe
  • Performance Options: %windir%\system32\SystemPropertiesPerformance.exe
  • System Properties, System Protection: %windir%\system32\SystemPropertiesProtection.exe
  • System Properties, Remote: %windir%\system32\SystemPropertiesRemote.exe
  • Windows Task Manager, Processes: %windir%\system32\taskmgr.exe /6

Tablet PC Settings

  • Tablet PC Settings, Display: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL TabletPC.cpl @1,display
  • Tablet PC Settings, Other: %windir%\system32\rundll32.exe shell32.dll,Control_RunDLL TabletPC.cpl @1,other

Taskbar and Navigation

  • Toolbars: %windir%\System32\rundll32.exe shell32.dll,Options_RunDLL 6
  • Navigation: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 8

Troubleshooting

  • Playing Audio: %windir%\system32\msdt.exe -id AudioPlaybackDiagnostic -ep ControlPanelSearch
  • Recording Audio: %windir%\system32\msdt.exe -id AudioRecordingDiagnostic -ep ControlPanelSearch
  • Hardware and Devices: %windir%\system32\msdt.exe -id DeviceDiagnostic -ep ControlPanelSearch
  • HomeGroup: %windir%\system32\msdt.exe -id HomeGroupDiagnostic -ep ControlPanelSearch
  • System Maintenance: %windir%\system32\msdt.exe -id MaintenanceDiagnostic -ep ControlPanelSearch
  • Internet Connections: %windir%\system32\msdt.exe -id NetworkDiagnosticsWeb -ep ControlPanelSearch
  • Printer: %windir%\system32\msdt.exe -id PrinterDiagnostic -ep ControlPanelSearch
  • Search and Indexing: %windir%\system32\msdt.exe -id SearchDiagnostic -ep ControlPanelSearch
  • Problem Steps Recorder: %windir%\system32\psr.exe

User Accounts

  • Certificate Manager: %windir%\system32\mmc.exe %windir%\system32\certmgr.msc
  • Local Users and Groups: %windir%\system32\mmc.exe %windir%\system32\lusrmgr.msc
  • User Accounts: %windir%\system32\netplwiz.exe
  • Manage your file encryption certificates: %windir%\system32\rekeywiz.exe
  • Forgotten Password Wizard: %windir%\system32\rundll32.exe keymgr.dll,PRShowSaveWizardExW

Windows Mobility Center

  • Presentation Settings: %windir%\system32\presentationsettings.exe

Windows Update

  • Check for updates: %windir%\system32\wuauclt.exe /showcheckforupdates

Windows To Go

  • Windows To Go Startup Options: %windir%\system32\rundll32.exe pwlauncher.dll,ShowPortableWorkspaceLauncherConfigurationUX

Related topics

Control Panel Items
User Experience Guidelines
Registering Control Panel Items
Using CPLApplet
Control Panel Message Processing
Extending System Control Panel Items
Assigning Control Panel Categories
Creating Searchable Task Links for a Control Panel Item
Accessing the Control Panel in Safe Mode

 

 

Добавления сообщества

ДОБАВИТЬ
Показ:
© 2014 Microsoft