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.
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?
To add a path to the PATH environment variableIn the System dialog box, click Advanced system settings. On the Advanced tab of the System Properties dialog box, click Environment Variables. In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.
To set a System Environment Variable rather than a User Environment Variable, we just need to use the /m option in the setx command and run it from an elevated(Administrator) Command Prompt.
On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable.
The Setx command also retrieves the values of registry keys and writes them to text files. This command provides the only command-line or programmatic way to directly and permanently set system environment values. System environment variables are manually configurable through Control Panel or through a registry editor.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With