Changing / adding environment variables

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

Windows variables are stored in the registry. You can change them by adding or modifying values in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.

Below, an example for adding two variables for Cygwin - with it, applications using cygwin1.dll will be able to use UTF-8 characters in file and path names:

Windows Registry Editor Version 5.00 
 
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] 
"CYGWIN"="codepage:utf8" 
"LC_CTYPE"="C-UTF-8"


Import with:

regedit /s "%SOFTWARE%\cygwin.reg

Windows 7 comes with the command "setx" which can change environment variables in several ways.