Adding a directory to the PATH environment variable in Windows

前端 未结 18 1388
我在风中等你
我在风中等你 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:14

    1. I have installed PHP that time. Extracted php-7***.zip into C:\php\
    2. Backup my current PATH environment variable: run cmd, and execute command: path >C:\path-backup.txt

    3. Get my current path value into C:\path.txt file (same way)

    4. Modify path.txt (sure, my path length is more than 1024 chars, windows is running few years)
      • I have removed duplicates paths in there, like 'C:\Windows; or C:\Windows\System32; or C:\Windows\System32\Wbem; - I've got twice.
      • Remove uninstalled programs paths as well. Example: C:\Program Files\NonExistSoftware;
      • This way, my path string length < 1024 :)))
      • at the end of path string add ;C:\php\
      • Copy path value only into buffer with framed double quotes! Example: "C:\Windows;****;C:\php\" No PATH= should be there!!!
    5. Open Windows PowerShell as Administrator.
    6. Run command:

    setx path "Here you should insert string from buffer (new path value)"

    1. Re-run your terminal (I use "Far manager") and check: php -v

提交回复
热议问题