1. 安装 pwsh7: [PowerShell 7 | Microsoft](
https://learn.microsoft.com/zh-cn/powershell/scripting/install/install-powershell-on-windows?view=powershell-7.6)
2. 安装 PowerShell.MCP:`Install-PSResource PowerShell.MCP`
3. 发给 codex 或者 claude:`我已安装 PowerShell.MCP(
github.com/yotsuda/PowerShell.MCP),帮我全局配置上这个 mcp ,使用绝对路径。`
4. 发给 codex 或者 claude:`帮我在全局提示词
AGENTS.md CLAUDE.md 加上下面的话(如果是
CLAUDE.md 不需要 codex 的 Exception)。Always use the mcp__PowerShell tool instead of the built-in tool for all command execution. Exception: for Codex-injected helper commands such as apply_patch and applypatch, use the built-in pwsh shell. (
CLAUDE.md 里边写 built-in bash tool 。)`。