Last active
May 19, 2026 08:46
-
-
Save Loongphy/12a1e2ece481a8ba6dae7dc16a2192ac to your computer and use it in GitHub Desktop.
Windows Codex Remote Control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function codex-lock { | |
| param( | |
| [int]$Seconds = 90 | |
| ) | |
| $cfg = "$HOME\.codex\config.toml" | |
| # 先确保 codex CLI 可以写配置 | |
| attrib -R "$cfg" | |
| codex features enable remote_control | |
| $pkg = Get-AppxPackage -Name OpenAI.Codex | |
| $manifest = Get-AppxPackageManifest -Package $pkg.PackageFullName | |
| $app = @($manifest.Package.Applications.Application)[0] | |
| $aumid = "$($pkg.PackageFamilyName)!$($app.Id)" | |
| try { | |
| attrib +R "$cfg" | |
| Start-Process "shell:AppsFolder\$aumid" | |
| Start-Sleep -Seconds $Seconds | |
| } | |
| finally { | |
| attrib -R "$cfg" | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
single line: