Chris Navarro
Chris Navarro

Reputation: 29

SETX not setting system variable when using /M

I am trying to set a persistent system variable. This is for a process in which a batch file refers to the variable, and then edits the variable at the end of the process.

I am using setx with the /M parameter, however, it continues to create the environment variable under the local user instead of the system.

The command I am specifically running is:

setx FN 101 /M

What am I missing?

Upvotes: 1

Views: 565

Answers (1)

Chris Navarro
Chris Navarro

Reputation: 29

I did not launch an elevated CMD. Turns out in order for the /M parameter to work, CMD must be run as an administrator.

Upvotes: 1

Related Questions