使用 Windows 版 App
Windows App 支持核心工作流:
Codex app for Windows 提供一个统一界面,用于跨 projects 工作、运行 parallel agent threads,并 review 结果。
Windows App 支持核心工作流:
- worktrees
- automations
- Git functionality
- in-app browser
- artifact previews
- plugins
- skills
它可以通过 PowerShell 和 Windows sandbox 在 Windows 上原生运行,也可以配置为在 Windows Subsystem for Linux 2 (WSL2) 中运行。
官方截图:
- light:https://developers.openai.com/images/codex/windows/codex-windows-light.webp
- dark:https://developers.openai.com/images/codex/windows/codex-windows-dark.webp
Download and update the Codex app
下载地址:
https://get.microsoft.com/installer/download/9PLM9XGG6VKS?cid=website_cta_psi
然后按 quickstart 开始。
更新方式:
- 打开 Microsoft Store。
- 进入 Downloads。
- 点击 Check for updates。
- Store 会安装最新版本。
Enterprise 场景下,administrators 可以通过 enterprise management tools 使用 Microsoft Store app distribution 部署 App。
如果你更喜欢 command-line install path,或需要绕开 Microsoft Store UI,可以运行:
winget install Codex -s msstoreNative sandbox
Windows 版 Codex App 在 agent 运行于 PowerShell 时支持 native Windows sandbox。当 agent 运行在 Windows Subsystem for Linux 2 (WSL2) 中时,则使用 Linux sandboxing。
无论哪种模式,要应用 sandbox protections,都需要在向 Codex 发送消息前,在 Composer 中把 sandbox permissions 设置为 Default permissions。
full access mode 表示 Codex 不再被限制在 project directory 内,可能执行非预期 destructive actions,并导致 data loss。建议保留 sandbox boundaries,并用 rules 做 targeted exceptions。
你也可以把 approval policy 设置为 never,让 Codex 根据你的 approval and security setup,尝试在不请求 escalated permissions 的情况下解决问题。
Customize for your dev setup
首选编辑器
为 Open 选择默认 app,例如 Visual Studio、VS Code,或其他 editor。
你可以按 project 覆盖这个选择。如果某个 project 已经从 Open menu 中选择了不同 app,project-specific choice 会优先。
官方截图:
- light:https://developers.openai.com/images/codex/windows/open-in-windows-light.webp
- dark:https://developers.openai.com/images/codex/windows/open-in-windows-dark.webp
集成终端
你也可以选择默认 integrated terminal。可选项取决于本机安装情况,常见包括:
- PowerShell
- Command Prompt
- Git Bash
- WSL
这个改动只影响新的 terminal sessions。如果 integrated terminal 已经打开,要重启 App 或启动新 thread,新的 default terminal 才会出现。
官方截图:
- light:https://developers.openai.com/images/codex/windows/integrated-shell-light.webp
- dark:https://developers.openai.com/images/codex/windows/integrated-shell-dark.webp
Windows Subsystem for Linux (WSL)
默认情况下,Codex App 使用 Windows-native agent,也就是 agent 在 PowerShell 中运行。App 仍然可以在需要时通过 wsl CLI 处理位于 Windows Subsystem for Linux 2 (WSL2) 中的 projects。
如果你想从 WSL filesystem 添加 project:
-
点击 Add new project,或按
Ctrl+O。 -
在 File Explorer window 中输入:
\\wsl$\ -
选择你的 Linux distribution。
-
选择要打开的 folder。
如果你计划继续使用 Windows-native agent,建议把 projects 存在 Windows filesystem 上,并在 WSL 中通过 /mnt/<drive>/... 访问。相比直接从 WSL filesystem 打开 project,这种方式更可靠。
如果你希望 agent 本身运行在 WSL2 中:
- 打开 Settings。
- 把 agent 从 Windows native 切换到 WSL。
- restart the app。
这个改动重启后才生效。重启后,projects 应该仍然保留。
WSL1 支持到 Codex 0.114。从 Codex 0.115 开始,Linux sandbox 切换到 bubblewrap,因此不再支持 WSL1。
官方截图:
- light:https://developers.openai.com/images/codex/windows/wsl-select-light.webp
- dark:https://developers.openai.com/images/codex/windows/wsl-select-dark.webp
Integrated terminal 和 agent 是分别配置的。terminal options 见 Customize for your dev setup。你可以让 agent 在 WSL 中运行,同时 terminal 仍使用 PowerShell;也可以两者都使用 WSL,取决于你的 workflow。
Useful developer tools
Codex 在常用 developer tools 已安装时效果更好:
| Tool | 用途 |
|---|---|
| Git | 支撑 Codex App review panel,并让你 inspect 或 revert changes。 |
| Node.js | agent 常用工具,可让部分 tasks 更顺畅。 |
| Python | agent 常用工具,可让部分 tasks 更顺畅。 |
| .NET SDK | 构建 native Windows apps 时有用。 |
| GitHub CLI | 支撑 Codex App 中 GitHub-specific functionality。 |
用 Windows 默认 package manager winget 安装。可以把下面命令粘贴到 integrated terminal,也可以让 Codex 安装:
winget install --id Git.Git
winget install --id OpenJS.NodeJS.LTS
winget install --id Python.Python.3.14
winget install --id Microsoft.DotNet.SDK.10
winget install --id GitHub.cli安装 GitHub CLI 后,运行:
gh auth login这样可以启用 App 中的 GitHub features。
如果你需要不同 Python 或 .NET version,替换为目标 package IDs。
排错 and FAQ
Run commands with elevated permissions
如果需要 Codex 以 elevated permissions 运行 commands,把 Codex App 本身以 administrator 身份启动。
安装后,打开 Start menu,找到 Codex,选择 Run as administrator。Codex agent 会继承这个 permission level。
PowerShell execution policy blocks commands
如果你之前没有在 PowerShell 中使用过 Node.js、npm 等工具,Codex agent 或 integrated terminal 可能遇到 execution policy errors。
如果 Codex 为你创建 PowerShell scripts,也可能出现这个问题。此时,你可能需要较宽松的 execution policy,PowerShell 才能运行这些 scripts。
错误可能类似:
npm.ps1 cannot be loaded because running scripts is disabled on this system.常见修复方式是把 execution policy 设置为 RemoteSigned:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned修改 policy 前,先查看 Microsoft 的 execution policy guide,确认细节和其他选项。
Local environment scripts on Windows
如果你的 local environment 使用 npm scripts 等 cross-platform commands,可以保留一份所有平台共享的 setup script 或 actions。
如果需要 Windows-specific behavior,创建 Windows-specific setup scripts 或 Windows-specific actions。
Actions 运行在 integrated terminal 使用的 environment 中。详见 Customize for your dev setup。
Local setup scripts 运行在 agent environment 中:agent 使用 WSL 时就是 WSL,否则是 PowerShell。
Share config, auth, and sessions with WSL
Windows App 使用和 Windows native Codex 相同的 Codex home directory:
%USERPROFILE%\.codex如果你也在 WSL 内运行 Codex CLI,CLI 默认使用 Linux home directory,因此不会自动和 Windows App 共享 configuration、cached auth 或 session history。
共享方式有两种:
- 在 file system 上同步 WSL
~/.codex和%USERPROFILE%\.codex。 - 设置
CODEX_HOME,让 WSL 指向 Windows Codex home directory:
`export` CODEX_HOME=/mnt/c/Users/<windows-user>/.codex如果希望每个 shell 都生效,把这个设置加入 WSL shell profile,例如 ~/.bashrc 或 ~/.zshrc。
Git features are unavailable
如果 Windows native 环境没有安装 Git,App 无法使用部分 features。
从 PowerShell 或 cmd.exe 安装:
winget install Git.GitGit isn't detected for projects opened from \\wsl$
目前,如果你想用 Windows-native agent 处理一个 WSL 也能访问的 project,最可靠 workaround 是把 project 存在 native Windows drive 上,并在 WSL 中通过 /mnt/<drive>/... 访问。
Cmder isn't listed in the open dialog
如果已安装 Cmder,但它没有出现在 Codex open dialog 中,把它加入 Windows Start Menu:右键 Cmder,选择 Add to Start,然后重启 Codex 或 reboot。