Windows 作業系統提供命令列介面 (CLI) 讓使用者透過文字指令與核心互動。本文概述常用內建指令分類、查詢方式與指令執行流程。
cmd → Entercd /d %SystemRoot%\System32help 列出所有指令;或 help | more 分頁顯示。| 類別 | 代表指令 | 用途 |
|---|---|---|
| 檔案/目錄管理 | dir, copy, move, del, md, rd, xcopy, robocopy | 檔案複製、移動、刪除、目錄建立/移除 |
| 磁碟/分割區 | format, chkdsk, diskpart, defrag, label, vol | 格式化、檢查、分割區管理、碎片整理 |
| 系統資訊/設定 | systeminfo, msinfo32, dxdiag, gpupdate, gpresult, tasklist, taskkill | 硬體/軟體資訊、群組原則、進程管理 |
| 網路診斷 | ping, ipconfig, netstat, tracert, nslookup, netsh, route, arp | 連線測試、IP 設定、埠號/路由/ARP 表查詢 |
| 服務/程序控制 | sc, net start/stop, schtasks, at, shutdown | 服務安裝/啟動/停止、排程工作、關機 |
| 登錄檔操作 | reg add/delete/query/export/import | 命令列讀寫登錄檔 |
| 環境/變數 | set, setx, path, prompt, title | 環境變數顯示/設定、提示字元自訂 |
cmd.exe 輸入指令字串按 Enter。cmd.exe 解析字串,區別內建指令 (Internal Commands:dir, cd, set 等) 與外部程式 (External Commands:.exe, .bat, .com)。cmd.exe 進程執行;外部程式則建立子進程執行對應映像檔。這與 Linux Shell (bash/zsh) 架構相似:cmd.exe 對應 Shell,系統呼叫對應 Kernel API。差異在於 Windows 採用 Win32 API / Native API,Linux 採用 POSIX / syscall。