0

Is there a way to update a system's PATH variable through Ruby, permanently? I have the following:

envPath = ENV["PATH"].dup
if envPath.include? "C:\\oracle\\product\\11.2.0\\client_1\\bin;" then
    envPath.slice! "C:\\oracle\\product\\11.2.0\\client_1\\bin;"
    ENV["PATH"] = envPath
    puts ENV["PATH"]
end

This successfully removes the variable I want to, but only for the current window - not permanently.

MrDuk
  • 14,538
  • 15
  • 62
  • 127
  • Looks like I can do it by calling [SETX](http://stackoverflow.com/questions/3835518/can-a-script-bat-make-changes-to-windows-path-environment-variable) – MrDuk Jan 07 '14 at 19:15
  • Cool. I wasn't aware of `SETX`. :) – lurker Jan 07 '14 at 19:34

1 Answers1

1

It's more a question about general computing and process behaviour not ruby special.

No this is not possible during runtime. Only a father process can configure the environment of it's child before start. Changing the environment of the father process or other processes during runtime isn't supported by any OS.

hek2mgl
  • 143,113
  • 25
  • 227
  • 253