I can't do it through the normal way because it's been locked out by administration (I'm at school). I'm just trying to add the Python installation.

Dani AI

Generated

: since the normal GUI is locked you can still make a permanent, per-user change (no admin needed) by writing to your user registry hive (HKCU\Environment). ’s idea of changing PATH at the prompt only affects the current shell; it is not persistent.

Backup the key, then inspect any existing user PATH:

reg export "HKCU\Environment" "%USERPROFILE%\env-backup.reg"
reg query "HKCU\Environment" /v PATH

To append a Python install folder to the user PATH without clobbering what is already there, use a small batch routine that reads the current HKCU value and writes the new REG_EXPAND_SZ value. Put this into a .bat (note the doubled percent signs); if you paste interactively, use single percents:

for /f "tokens=2,*" %%A in ('reg query "HKCU\Environment" /v PATH 2^>nul') do set "userpath=%%B"
if defined userpath (
  reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "%userpath%;C:\Python27" /f
) else (
  reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "C:\Python27" /f
)

Notes and cautions:

  • Changes written to HKCU are permanent for the user but Explorer and already-running programs won’t see them until you log off/log on (or restart Explorer). New command prompts started after the change will pick it up.
  • Use REG_EXPAND_SZ for PATH so embedded %SYSTEMROOT% style tokens remain expandable.
  • Keep the backup file (env-backup.reg) in case you need to restore.
  • If you have or can run setx, it is an alternative to write user variables; older setx tools may truncate long values, so test first.

This method avoids needing admin rights while making a persistent per-user PATH change suitable for running Python from the command line.

At the command prompt enter: PATH %PATH%;YourNewVariable

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.