Share via


執行主控台專案

注意

如果您要尋找主控台專案的正式和模組名稱清單,請參閱主控台專案的正式名稱

 

有兩種方式可以開啟主控台專案:

  • 使用者可以開啟主控台,然後按一下或按兩下專案的圖示來開啟專案。
  • 使用者或應用程式可以直接從命令列提示字元執行主控台專案。

應用程式可以使用WinExec函式,以程式設計方式開啟主控台。

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

下列範例示範應用程式如何使用WinExec函式來啟動名為MyCpl.cpl主控台專案。

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

當主控台專案透過命令列開啟時,您可以指示該專案開啟至專案中的特定索引標籤。 由於某些 Windows Vista 主控台專案中某些索引標籤的新增和移除,因此索引標籤的編號可能已從 Windows XP 中變更。 例如,下列範例會在 Windows XP 上的 [系統] 專案中啟動第四個索引標籤,並在 Windows Vista 上啟動第三個索引標籤。

control.exe sysdm.cpl,,3

本主題將討論下列內容:

Windows Vista 標準名稱

在 Windows Vista 和更新版本中,從命令列啟動主控台專案的慣用方法是使用主控台專案的正式名稱。 標準名稱是主控台專案在登錄中宣告的非當地語系化字串。 使用標準名稱的值是它會抽象化主控台專案的模組名稱。 您可以在 .dll 中實作專案,稍後再重新實作為 .exe 或變更其模組名稱。 只要標準名稱維持不變,則使用該標準名稱開啟它的任何程式都不需要更新。

依照慣例,標準名稱的格式為 「CorporationName.ControlPanelItemName」。

下列範例示範應用程式如何使用WinExec啟動主控台專案Windows Update

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

若要以正式名稱啟動主控台專案,請使用:「%systemroot%\system32\control.exe /name canonicalName

若要在專案中開啟特定子頁面,或以其他參數開啟它,請使用:「%systemroot%\system32\control.exe /name canonicalName / pageName

應用程式也可以實作IOpenControlPanel::Open方法來啟動主控台專案,包括開啟特定子頁面的能力。

如需主控台專案標準名稱的完整清單,請參閱主控台專案的正式名稱

Windows Vista 的新命令

在 Windows Vista 上,Windows XP 上 .cpl 模組存取的某些選項現在會實作為 .exe 檔案。 這可藉由允許在嘗試啟動檔案時提示標準使用者提供系統管理員認證,以提供額外的安全性。 不需要額外安全性的選項,可以透過 Windows XP 中使用的相同命令列來存取。 以下是 Windows Vista 中用來存取主控台專案之特定索引標籤的命令清單:

個人化

  • 字型大小和 DPI: %windir%\system32\DpiScaling.exe
  • 螢幕解析度: %windir%\system32\control.exe desk.cpl,設定,@Settings
  • 顯示設定: %windir%\system32\control.exe desk.cpl,設定,@Settings
  • 主題: %windir%\system32\control.exe desk.cpl,主題,@Themes
  • Screensaver: %windir%\system32\control.exe desk.cpl,screensaver,@screensaver
  • 多監視器: %windir%\system32\control.exe desk.cpl,監視器,@Monitor
  • 色彩配置: %windir%\system32\control.exe /name Microsoft.Personalization /pageColorization
  • 桌面背景: %windir%\system32\control.exe /name Microsoft.Personalization /pageWallpaper

注意

Starter 和 Basic Edition 不支援 control.exe /name Microsoft.Personalization 命令。

 

系統

  • 效能: %windir%\system32\SystemPropertiesPerformance.exe
  • 遠端存取: %windir%\system32\SystemPropertiesRemote.exe
  • 電腦名稱稱: %windir%\system32\SystemPropertiesComputerName.exe
  • 系統保護: %windir%\system32\SystemPropertiesProtection.exe
  • 進階系統屬性: %windir%\system32\SystemPropertiesAdvanced.exe

[程式和功能]

  • 新增或移除程式: %windir%\system32\control.exe /name Microsoft.ProgramsAndFeatures
  • Windows 功能: %windir%\system32\OptionalFeatures.exe

地區及語言選項

  • 鍵盤: %systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:「keyboard」
  • 位置: %systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:「location」
  • 系統管理:%systemroot%\system32\control.exe /name Microsoft.RegionalAndLanguageOptions /page /p:「administrative」

資料夾選項

  • 資料夾搜尋: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 2
  • 檔案關聯: %windir%\system32\control.exe /name Microsoft.DefaultPrograms /pageFileAssoc
  • 檢視: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 7
  • 一般: %windir%\system32\rundll32.exe shell32.dll,Options_RunDLL 0

電源選項

  • 編輯目前的方案設定:%windir%\system32\control.exe /name Microsoft.PowerOptions /pagePlanSettings
  • 系統設定: %windir%\system32\control.exe /name Microsoft.PowerOptions /pageGlobalSettings
  • 建立電源計劃: %windir%\system32\control.exe /name Microsoft.PowerOptions /pageCreateNewPlan
  • [進階設定] 頁面沒有標準命令,以較舊的方式存取: %windir%\system32\control.exe powercfg.cpl,,3

舊版主控台命令

當您使用WinExec函式時,系統可以辨識特殊主控台命令。 這些命令會預先設定 Windows Vista。

引數 描述
control.exe 桌面 啟動 [ 顯示內容 ] 視窗。 注意: Starter 和 Basic Edition 不支援此命令。
control.exe 色彩 啟動 [ 顯示內容 ] 視窗,並預先選取 [ 外觀 ] 索引標籤。
control.exe 日期/時間 啟動 [ 日期和時間屬性] 視窗。
control.exe 國際 啟動 [ 地區和語言選項] 視窗。
control.exe 滑鼠 啟動 [滑鼠屬性] 視窗。
control.exe 鍵盤 啟動 [ 鍵盤屬性] 視窗。
control.exe 印表機 顯示 [印表機] 和 [傳真] 資料夾。
control.exe 字型 顯示 Fonts 資料夾。

 

針對 Windows 2000 和更新版本系統:

命令 描述
control.exe 資料夾 啟動 [ 資料夾選項] 視窗。
control.exe netware 如果安裝) ,就會啟動 [Novell NetWare ] 視窗 (。
control.exe 電話語音 啟動 [ 電話] 和 [數據機選項] 視窗。
control.exe admintools 顯示 [ 系統管理工具] 資料夾。
control.exe schedtasks 顯示 [排程的工作 ] 資料夾。
control.exe netconnections 顯示 [網路連線 ] 資料夾。
control.exe 基礎結構 如果已安裝) ,啟動 [ 基礎結構監視器] 視窗 (。
control.exe userpasswords 啟動 [ 使用者帳戶] 視窗。

 

主控台專案

使用者體驗指南

註冊主控台專案

使用 CPL Applet

主控台訊息處理

擴充系統主控台專案

指派主控台類別

為主控台專案建立可搜尋的工作連結

在 Windows Vista 下以安全模式存取主控台