0

I have to create system variable in Windows through calling CMD.Exe. I try :

cmd.exe /C maVar=maVal

Saddly, no maVar is created.

If i open CMD.Exe and type :

maVar=maVal

-> maVar is created.

Saddly, i have to do it through calling cmd.exe, not launching cmd.exe. Anyone know what is ly mistake ?

Thanks

  • So it appears by your comment in the answer below that you did not read the post @Ramhound pointed you at. The answer below is not only a duplicate, it is of lower quality than the reference Ramhound provided. Yes, setting *permanent* variables from the windows command prompt is kinda wonkie.. but that is true in all operating systems. – Señor CMasMas Jun 24 '21 at 16:58

1 Answers1

0

Use setx command to create system variable, set command define variables only inside of current cmd session.

user2956477
  • 222
  • 1
  • 11
  • Thanks. I tried it, but when i type "set" in order to see all my variables, my variables is not in the list. – Walter Fabio Simoni Jun 24 '21 at 16:28
  • @WalterFabioSimoni - Depending on if you are setting the system or user variable you might have to close the command prompt session. – Ramhound Jun 24 '21 at 17:01
  • you have to reopen new cmd windows to see created system variable, cmd.exe read system variables only once when it starting – user2956477 Jun 25 '21 at 19:26