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

1
  • 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. Commented Jun 24, 2021 at 16:58

1 Answer 1

0

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

3
  • Thanks. I tried it, but when i type "set" in order to see all my variables, my variables is not in the list. Commented Jun 24, 2021 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
    Commented Jun 24, 2021 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 Commented Jun 25, 2021 at 19:26

Not the answer you're looking for? Browse other questions tagged .