[Windows] One-click updater .bat for Codex CLI (npm) — safe kill, skip-if-latest, alt prefix, progress UI #3574
Replies: 2 comments
-
|
But for now just save it as a .bat file in your codex cli folder :: ------------------------------------------------------------ set "STEP=0" :: ---- parse args ------------------------------------------------ call :header :: [1] Kill Codex (and optionally node.exe) :: [2] Ensure npm :: [3] Discover npm global root dynamically :: [4] Detect current Codex version :: [5] Clean stale staging dirs (.codex-) :: [6] Query latest on npm (optional) :: [6.5] Skip install if already latest (unless --forceinstall) :: [7] Install/update @openai/codex@latest (primary attempt) :verify if defined NEWVER ( echo. :: ---------- helpers ---------- :usage :step :bar :end |
Beta Was this translation helpful? Give feedback.
-
|
update-codex-cli.txt |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I made a Windows one-click updater for Codex CLI that:
• safely kills codex.exe (optionally node.exe with --killnode)
• cleans stale .codex-* staging dirs that can cause EBUSY/EPERM
• skips install when already on the latest (unless --forceinstall)
• supports an alternate npm prefix (--alt) when global dir is locked
• narrates steps and shows a simple progress bar
Tested with codex-cli 0.34.0 (latest as of Sep 10, 2025).
Usage (at script start is printed too):
update-codex-cli.bat [--forceinstall] [--killnode] [--alt]
Flags:
--forceinstall Force reinstall even if already on latest
--killnode Also stop node.exe (may stop n8n/dev servers)
--alt Install to %LocalAppData%\codex-global\bin
I will put the example.bat file under
scripts/windows/update-codex-cli.bat
Beta Was this translation helpful? Give feedback.
All reactions