windowsbatch-filecmdsystem-variablesetx

SETX doesn't append path to system path variable


I have tried below command to append some path to system path variable by batch-file :

setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin"

I have checked system variable path after running above batch-file, above path isn't in there.

enter image description here

You can see all windows Variable value content in below :

C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMDAPP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles (x86)\ATI Technologies\ATI.ACE\Core-Static;

What am i doing wrong?


Solution

  • To piggy-back on @Endoro's answer (I lack the rep to comment):

    If you want to change the system-wide environment variables, you have to use /M, a la:

    setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" /M
    

    setx.exe is picky about placement of the /M, BTW. It needs to be at the end.