Appearance
配置文件拒绝访问
如果看到:
text
Error loading config.toml: 拒绝访问 (os error 5)这不是安装失败,而是当前 Windows 用户没有读取 .codex\config.toml 的权限。

修复权限
以管理员身份打开 PowerShell,执行:
powershell
$codex = "$env:USERPROFILE\.codex"
$user = "$env:USERDOMAIN\$env:USERNAME"
takeown /f $codex /r /d y
icacls $codex /reset /t /c
icacls.exe $codex /grant:r "$($user):(OI)(CI)F" /t /c关闭管理员窗口,重新打开普通 PowerShell,再运行:
powershell
codex$env:CODEX_HOME 没有输出是正常的,表示 Codex 使用默认目录:C:\Users\你的用户名\.codex。
WARNING
只对自己的 .codex 目录执行权限修复,不要把命令中的路径改成系统目录。
权限显示成功但仍无法读取
先备份原配置,再由普通用户重新创建文件。管理员 PowerShell:
powershell
$config = "$env:USERPROFILE\.codex\config.toml"
Copy-Item $config "$env:USERPROFILE\Desktop\codex-config-backup.toml" -Force
Remove-Item $config -Force关闭管理员窗口,在普通 PowerShell 中执行:
powershell
$config = "$env:USERPROFILE\.codex\config.toml"
New-Item -ItemType File -Path $config -Force
Copy-Item "$env:USERPROFILE\Desktop\codex-config-backup.toml" $config -Force
Get-Content $config确认 Codex 正常启动后,再删除桌面备份。