# How did Windows python Setup add python PATH to the user enviroment variables?

**URL:** <https://discuss.python.org/t/how-did-windows-python-setup-add-python-path-to-the-user-enviroment-variables/36880>\
**Category:** Python Help\
**Created:** [October 22, 2023, 1:37pm UTC](https://discuss.python.org/t/how-did-windows-python-setup-add-python-path-to-the-user-enviroment-variables/36880 "2023-10-22T13:37:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darkyy69](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/darkyy69/32/15448_2.png) [@Darkyy69](https://discuss.python.org/u/Darkyy69)\
**Post date:** [October 22, 2023, 1:37pm UTC](https://discuss.python.org/t/how-did-windows-python-setup-add-python-path-to-the-user-enviroment-variables/36880/1 "2023-10-22T13:37:51Z")

</div>

i made alot of researches about this topic but didnt find any solution or documentation about the process of adding Python to the PATH , i’m trying to automate something to add a directory automatically to the user’s env var path like you did in the Setup, but it seems like: setx PATH “%PATH%;C:\something” doesnt work well because it made my user env var the same as the System env vars and it doesnt add the path i want to.when trying to print the path with:  
user\_path = os.environ.get(‘Path’)  
it print out both the SYS first and then ;USER

---

<div class="post-metadata">

**Author:** ![csm10495](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/csm10495/32/9731_2.png) [@csm10495](https://discuss.python.org/u/csm10495)\
**Post date:** [October 22, 2023, 4:44pm UTC](https://discuss.python.org/t/how-did-windows-python-setup-add-python-path-to-the-user-enviroment-variables/36880/2 "2023-10-22T16:44:32Z")

</div>

It can be done using the `setx /m` command. See [setx | Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/setx) for details.
