Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Windows 7 內建 PowerShell v2 入門:指令發現、別名、程序管理與服務/登錄/網路操作

編輯:Windows 7 系統介紹

什麼是 PowerShell?

PowerShell 是微軟為 Windows 開發的命令列殼層與腳本語言,填補 Unix Shell 的缺口,提供物件導向管線、.NET 整合、遠端管理等能力。Win 7 內建 PowerShell v2 並支援圖形化 ISE 編輯器。

啟動方式

  • 開始 → 搜尋 PowerShell → 選擇「Windows PowerShell」(命令列)或「Windows PowerShell ISE」(圖形化)。
  • CMD 中輸入 PowerShell 切換環境。

核心指令速查

進階應用領域

  • 服務管理:Get-Service、Start/Stop/Restart-Service、Set-Service -StartupType。
  • 登錄操作:Get-ItemProperty、Set-ItemProperty、New-Item 操作 HKLM:、HKCU: 等磁碟機。
  • 事件記錄:Get-EventLog、Get-WinEvent 篩選系統/應用程式記錄。
  • 網路設定:Get-NetIPConfiguration、Test-Connection、New-NetFirewallRule 等(v3+ 功能較豐富,v2 需用 WMI/CIM)。

學習建議

習慣使用 Get-Help 與 Get-Command 現場探索,搭配 ISE 的 IntelliSense 與腳本窗格,漸進式建立自動化腳本庫。微軟官方文件與 Script Center 提供大量範例可供參考。

Copyright © Windows教程網 All Rights Reserved
目的指令說明
列出所有可用指令Get-Command顯示類型、名稱、說明
查看指令詳細用法Get-Help <指令>如 Get-Help Add-Content
檢視執行中程序Get-Process顯示 Handles、CPU、Id 等
結束指定程序Stop-Process -Id <PID>可接受多個 ID
建立別名Set-Alias gp Get-Process之後輸入 gp 等同 Get-Process
啟動內建程式notepad 或 Set-Alias np notepad別名可縮短輸入