Reading Windows (NT/2000/XP) system and user environment variables

Felix McAllister felix_mcallister at hotmail.com
Fri Oct 3 04:20:28 EDT 2003


If you need to get the list of system environment variables and the (separate) list of user environment variables, you'll have to read the following registry settings:

System:  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

User:    HKEY_CURRENT_USER\Environment

You can use the win32api functions RegConnectRegistry, RegOpenKey, RegQueryValue etc. for these.

Felix.

> What is the best way in Python version 2.x to read/get Windows (nt/2000/xp)
> system and user environment variables?
> 
> Thanks for the help!
> 
> jep




More information about the Python-list mailing list