Home > Enterprise >  (Python, Windows) How to add a new folder to PATH without going to advanced settings? From command l
(Python, Windows) How to add a new folder to PATH without going to advanced settings? From command l

Time:07-08

I'm practicing python coding in my free time at work and am currently working on a little web scraping script. However, I kept running into an issue where the selenium webdriver wasn't in the PATH, and so last time I was online I found a way to go to the command line, type

echo %PATH%

which showed me all my directories. Then, I was able to add a new one which was where my webdriver exes were located. I realize now I could have just plopped the chrome webdriver into one of the directories shown, but I really want to figure out how I was able to do that. Unfortunately, all the guides I find online discuss going into Advanced System Settings, which unfortunately I'm locked out of due to work computer permissions. However, I'd love to be able to keep messing around with it. Any help would be greatly appreciated!

Thanks!

CodePudding user response:

If you wish to set an environment variable from Windows Command Prompt, you can do so using the setx command:

setx PATH "%PATH%;<your-new-path>"

You won't see the new value when you echo %PATH% just after setting it this way, you need to close cmd and open it again.

  • Related