On Windows, how can I use Ruby to permanently set an environment variable? I know I need to change the registry (through the win32ole module?) but I am a novice with regard to scripting the registry.
I understand that I can say ENV['FOO'] = "c:\bar\baz"
to set the environment variable FOO
for the session. However, I am instead interested in setting environment variables globally and permanently.
I did find the patheditor gem, which works great for permanently altering the Windows PATH
. But I want to set other environment variables, for example, JAVA_HOME
.