windows - Programmatically modifiy environment variables? -
- Windows 7
- This is for my own machine, so no matter what it requires, administrative rights or something else is required.
- Preferably in Python or .NET, but I can learn some required Win32 (C / C ++) programming.
If you want to permanently set the environment variable, Can insert values. For example, with vbscript, add path "c: \ test" to the path variable
set WshShell = WScript.CreateObject ("WScript.Shell") strReg = "HKLM \ System \ CurrentControlSet \ Control \ session manager \ environment \ path "strSetting = WshShell.RegRead (strReg) strNewSetting = strSetting & amp;" c \ test "WshShell.RegWrite strReg, strNewSetting
Languages used by Python or others, you can use your own language API / module to read and write the registry.
Comments
Post a Comment