0
有没有办法通过Ruby永久更新系统的PATH变量?我有以下几点:Ruby:我可以更新系统环境变量吗?
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
这成功地消除我想变,但只适用于当前窗口 - 不会永久。
看起来我可以通过调用[SETX]来实现它(http://stackoverflow.com/questions/3835518/can-a-script-bat-make-changes-to-windows-path-environment-variable) – MrDuk
凉。我不知道'SETX'。 :) – lurker