Adding a directory to the PATH environment variable in Windows

前端 未结 18 1392
我在风中等你
我在风中等你 2020-11-21 05:13

I am trying to add C:\\xampp\\php to my system PATH environment variable in Windows.

I have already added it using the Environment Varia

18条回答
  •  一生所求
    2020-11-21 06:05

    Option 1

    After you change PATH with the GUI, close and re-open the console window.

    This works because only programs started after the change will see the new PATH.

    Option 2

    Execute this command in the command window you have open:

    set PATH=%PATH%;C:\your\path\here\
    

    This command appends C:\your\path\here\ to the current PATH.

    Breaking it down:

    • set – A command that changes cmd's environment variables only for the current cmd session; other programs and the system are unaffected.
    • PATH= – Signifies that PATH is the environment variable to be temporarily changed.
    • %PATH%;C:\your\path\here\ – The %PATH% part expands to the current value of PATH, and ;C:\your\path\here\ is then concatenated to it. This becomes the new PATH.

提交回复
热议问题