claude-code-notifier
運作方式 指南 常見問題
◐繁體中文
English العربية Deutsch Español Français עברית Italiano 日本語 한국어 Nederlands Polski Português (Brasil) Русский Türkçe Tiếng Việt 简体中文 繁體中文
開始使用
所有指南

在 Windows 上接收 Claude Code 通知(PowerShell 與 WSL)

更新於 2026年10月31日 · 閱讀時間 6 分鐘
本頁內容 01原生 Windows 還是 WSL:hook 在哪裡執行 02快速測試:terminal bell 03用 PowerShell 建立 Notification hook 04用 BurntToast 顯示真正的快顯通知 05從 WSL:透過 interop 呼叫 Windows 06Claude Code Notifier 的角色 07常見問題

在 Windows Terminal、PowerShell 或 VS Code terminal 中,Claude Code 預設不會顯示桌面通知,所以在 Windows 上要自己加。在 %USERPROFILE%\.claude\settings.json 加入執行 PowerShell 的 Notification hook(以及用於「完成」的 Stop hook):訊息方塊不需安裝任何東西就能用,BurntToast 模組則能顯示正式的快顯通知。如果 Claude Code 是在 WSL 中執行,hook 會在 Linux 裡跑,因此必須透過 Windows interop 呼叫 powershell.exe,通知才能到達 Windows 桌面。

01原生 Windows 還是 WSL:hook 在哪裡執行

Claude Code 可以在原生 Windows 或 WSL 中執行,這會決定通知 hook 的運作方式。

  • 原生 Windows。設定檔位於 %USERPROFILE%\.claude\settings.json。根據 Anthropic 的 hooks 參考文件,command hook 預設在 Git Bash 中執行,若未安裝 Git Bash 則改用 PowerShell。你可以用 "shell": "powershell" 強制單一 hook 使用 PowerShell;此時 Claude Code 若找得到 pwsh.exe(PowerShell 7)就會使用它,否則使用 powershell.exe(Windows PowerShell 5.1)。
  • WSL。你是在 WSL terminal 中安裝並執行 claude,所以設定檔是 Linux 那份,也就是發行版內的 ~/.claude/settings.json,hook 也會在 Linux shell 中執行。在那裡用 notify-send 通常到不了 Windows 桌面,請改為呼叫 Windows 程式。

02快速測試:terminal bell

最簡單的提示方式就是 bell。在設定檔中加入:

{
  "preferredNotifChannel": "terminal_bell"
}

這樣 Claude Code 在完成或等待你回應時就會送出 bell 字元。在 Windows Terminal 中,bell 的行為由其 settings.json 裡各設定檔的 bellStyle 決定。"bellStyle": ["window", "taskbar"] 會閃爍視窗和工作列按鈕,而不是播放聲音。更多說明請見 terminal bell 指南。這個方法只有在 terminal 在你視線範圍內時才有用。

03用 PowerShell 建立 Notification hook

這是 Anthropic hooks 指南中的 Windows 範例,不需安裝任何東西:

{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe -Command \"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Claude Code needs your attention', 'Claude Code')\""
          }
        ]
      }
    ]
  }
}

它會開啟一個對話方塊,而不是螢幕角落的快顯通知,而且對話方塊可能出現在 terminal 後面。請先在 PowerShell 中測試指令,再於 Claude Code 輸入 /hooks 確認 hook 已載入。

空的 matcher 會對所有通知類型觸發,包括 permission_prompt(核准請求已等待約六秒)和 idle_prompt(Claude 約 60 秒前已完成)。觸發時機請參考 Notification hook 指南。

04用 BurntToast 顯示真正的快顯通知

BurntToast 是廣泛使用、由社群維護的 PowerShell 模組,用於顯示 Windows 快顯通知。為你的使用者帳號安裝一次即可:

Install-Module -Name BurntToast -Scope CurrentUser

接著確認它能正常運作:

New-BurntToastNotification -Text 'Claude Code', 'Claude needs your attention'

在 hook 中使用它。這個版本會以不載入 profile 的方式啟動 PowerShell,並僅針對這次呼叫略過執行原則,因此無論從 Git Bash 或 PowerShell 執行,結果都一樣:

{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"New-BurntToastNotification -Text 'Claude Code', 'Claude needs your attention'\""
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"New-BurntToastNotification -Text 'Claude Code', 'Claude has finished'\"",
            "async": true
          }
        ]
      }
    ]
  }
}

Stop hook 會在每一輪結束時執行,任務一完成你就會知道,不用等一分鐘;請參考 Stop hook 指南。"async": true 會讓 hook 在背景執行,避免 PowerShell 啟動太慢而拖住 Claude Code。

如果快顯通知始終沒出現,請檢查設定 > 系統 > 通知:通知必須開啟,「勿打擾」必須關閉。BurntToast 的通知通常會歸在 Windows PowerShell 底下,它的通知也需要允許。

05從 WSL:透過 interop 呼叫 Windows

在 WSL 中 hook 是在 Linux 裡執行,但 WSL 可以用 .exe 名稱啟動 Windows 程式。Anthropic 的指南提到,powershell.exe 必須透過 Windows interop 出現在你的 PATH 中。這是預設行為,由 /etc/wsl.conf 中 [interop] 區段的 appendWindowsPath 控制。在 WSL shell 中確認:

command -v powershell.exe

只要在 Windows 端安裝了 BurntToast,WSL 中 ~/.claude/settings.json 的 hook 就是同一個指令:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"New-BurntToastNotification -Text 'Claude Code', 'Claude has finished'\"",
            "async": true
          }
        ]
      }
    ]
  }
}

從 WSL 啟動 Windows PowerShell 可能要一秒以上,這也是使用 "async": true 的另一個理由。

06Claude Code Notifier 的角色

如果你人在電腦前,上面這些 hook 就夠用了。但一離開座位它們就沒用了,而且快顯通知無法替 Claude 核准指令。

Claude Code Notifier 是一款建構在 Claude Code hooks 之上的獨立工具(由 TouchTap 開發,並非 Anthropic)。它的免費命令列工具 ccn 支援 Mac、Windows 和 Linux;Windows 版目前為 beta。在原生 Windows 上,從 PowerShell 安裝:

irm https://claudecodenotifier.com/install.ps1 | iex

它會把自己的 hook 項目加入你的 Claude Code 設定,不動檔案其他部分,並保留備份。裝好後立即可用:當 Claude 完成、需要權限或提出問題時,就會顯示 Windows 快顯通知,不需要手機,也不需要網路。因為它掛在 Claude Code 上而不是 terminal 上,所以在 Windows Terminal、PowerShell 和 IDE terminal 中表現都一樣。

如果 Claude Code 在 WSL 中執行,請在 WSL 內用 Linux 的安裝指令安裝 ccn,因為 Claude Code 和它的設定都在那裡:

curl -fsSL https://claudecodenotifier.com/install.sh | sh

接著執行 ccn test。從 WSL 發出的桌面通知能否到達 Windows 桌面,取決於你的 WSL 設定,因此在 WSL 上用手機接收最可靠。配對手機後,事件會以 push 通知送達,你可以在手機上允許一次、在本次工作階段中允許或拒絕權限,回答 Claude 的問題,並送出下一個指示。手機 App 相關資訊請參考配對手機、ccn 頁面和價格方案。

如果安裝了 ccn,請移除你自己設定的 toast hook,以免收到重複通知。

07常見問題

為什麼我的 PowerShell hook 在 Windows 上沒有任何反應?

先在 PowerShell 裡直接執行同一個指令。如果能正常運作,再確認 /hooks 有列出該 hook,以及 JSON 跳脫字元是否正確(每個內層的 " 都要加反斜線)。若使用 BurntToast,請確認模組是安裝在執行 Claude Code 的同一個使用者底下,而且「勿擾模式」已關閉。

Windows 上的 Claude Code 需要 Git Bash 才能跑 hook 嗎?

不需要。有安裝 Git for Windows 時,hook 會在 Git Bash 中執行;沒有的話則在 PowerShell 中執行。你也可以針對單一 hook 設定 "shell": "powershell"。

notify-send 在 WSL 裡能用嗎?

通常無法通知到 Windows 桌面。比較可靠的做法是如上所示,在 hook 中透過 WSL interop 呼叫 powershell.exe。

Windows Terminal 本身能顯示 Claude Code 通知嗎?

預設不行。可以把 preferredNotifChannel 設為 terminal_bell,並選一個會讓視窗或工作列閃爍的 bellStyle,或改用 hook 來跳出 toast。

有免費取得 Windows 通知的方法嗎?

有。上面的 PowerShell hook 和 ccn 的桌面通知都是免費的,只有手機 App 需要訂閱或買斷。

Claude Code Notifier Claude Code 完成或需要你處理時,手機會收到 push 通知,並可直接在手機上核准、拒絕或回覆。ccn 命令列工具在 Mac、Windows 和 Linux 上皆可免費使用。
下載 iOS 版 下載 Android 版 安裝 ccn

相關指南

  • Claude Code hook 完整解析:每個事件及其用途介紹 Claude Code hook 是什麼、要寫在 settings.json 的哪裡、matcher、輸入與 exit code 如何運作,以及每個 hook 事件的用途。
  • Claude Code 的 Notification hook:觸發時機與使用方式Claude Code 的 Notification hook 何時觸發、permission_prompt 和 idle_prompt 代表什麼、它收到的輸入,以及為何會延遲觸發。
  • Linux 上的 Claude Code 通知在 Claude Code 完成工作或需要輸入時收到 Linux 桌面通知:notify-send hook、音效、terminal 跳脫序列,或使用 ccn。
  • 在 VS Code、Cursor 與 JetBrains terminal 中接收 Claude Code 通知為什麼 Claude Code 完成時 IDE terminal 毫無動靜,以及如何透過設定或 hook 在 VS Code、Cursor 與 JetBrains 中收到提醒。
claude-code-notifier

Claude Code Notifier 為獨立的第三方應用程式,與 Anthropic, PBC 並無關聯,亦未獲其背書或贊助。「Claude」及「Claude Code」為 Anthropic, PBC 之商標。

App iOS App Android App ccn(macOS、Windows、Linux) 所有指南
法律資訊 隱私權政策 服務條款 其他語言 © 2026 touchtap. 保留所有權利。 TouchTap Ltd 註冊於英格蘭和威爾斯,公司編號 13942589。