Windows

setx

CautionSet env vars permanently

setx <VAR> "<value>"

Persists env vars (/m = machine-wide). Beware the 1024-char limit — it can truncate PATH.

Examples

  • setx JAVA_HOME "C:\jdk21" /mSet a machine-wide variable

Syntax

setx <VAR> <value> [/m]

Before you run it

Rewriting PATH via setx risks truncation.

Related commands

  • setShow/set env vars (session)
  • regRegistry from the CLI

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store