I have a folder that I have placed in the path environment variable (windows 7) such that I can run my python programs from any directory (using python -m <python.py>). Recently I have noticed that the command does not work when I open a command line as administrator but does when I open as a regular user.

Does anybody know why this might be the case and how I can fix the problem?


I believe this answer by pcmind would be your best bet: https://stackoverflow.com/questions/8685699/windows-7-environment-variable-not-working-in-path

copied from link above:

I had exactly the same problem, to solve it, you can do one of two things:

  • Put all variables in System Variables instead of User and add the ones you want to PATH


  • Put all variables in User Variables, and create or edit the PATH variables in User Variable, not In System. The Path variables in System don't expand the User Variables.

If the above are all correct, but the problem is still present, you need to check the system Registry, in HKEY_CURRENT_USER\Environment, to make sure the "PATH" key type is REG_EXPAND_SZ (not REG_SZ).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.