SETX not setting system variable when using /M

286 views Asked by At

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?

1

There are 1 answers

0
Chris Navarro On BEST ANSWER

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