本文介绍了通过ruby脚本更改Windows浏览器代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在寻找一些代码/库,以编程方式使用Ruby on Windows更改流行浏览器的代理设置。谢谢。

I'm looking for some code/library to programmatically change proxy settings for popular browsers using Ruby on Windows. Thanks.

推荐答案

对于 Internet Explorer ,设置存储在注册表中(在<$ c $下) c> HKCU \Software \ Mysoftoft \ Windows \ CurrentVersion \Internet Settings 。)寻找 ProxyServer ProxyOverride 等等,所以可以使用。例如

For Internet Explorer the settings are stored in the Registry (under HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings.) Look for ProxyServer, ProxyOverride etc. so these could be modified using Win32::Registry. e.g.

require 'win32/registry'

proxy = "proxy goes here"
Win32::Registry::HKEY_CURRENT_USER.open(
  "Software\\Microsoft\\Windows\CurrentVersion\\Internet Settings\\",
  Win32::Registry::KEY_WRITE) do |reg|
    reg.write("ProxyServer",Win32::Registry::REG_SZ, proxy)
end

对于 Firefox ,您需要确定要更改的配置文件,然后可以修改 prefs.js 文件。但是,如果Firefox当时正在运行,那么我认为它不会提取你的更改,并且会在退出时用原始值重写prefs文件。

For Firefox you would need to determine which profile you wanted to change and could then modify the prefs.js file. However if Firefox was running at the time then I don't think it wouldn pickup your your change and would rewrite the prefs file with the original value on exiting.

这篇关于通过ruby脚本更改Windows浏览器代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 13:38