3

我使用以下代码制作了一个批处理程序来启用和禁用 Internet 选项中的代理使用:

[Enable]
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f 

[Disable]
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f 

此代码工作正常,但为了应用更改并使用代理连接到 Internet,我必须关闭并重新打开浏览器。有没有办法在不这样做的情况下应用代理。

我已经尝试过“ipconfig /renew”和“ipconfig /release”。我还尝试禁用和启用我的本地连接。

如果知道通过批处理/cmd 或其他程序连接到代理的另一种方法,并且没有这个问题,那也会有所帮助。

4

3 回答 3

0

我不使用代理,所以这对我来说是空白的,但这个命令似乎是你想要的。

netsh winhttp ?

显示有关设置代理等的帮助。

这是设置代理的帮助

C:\Users\User>netsh winhttp set proxy ?

Usage:  set proxy [proxy-server=]<server name> [bypass-list=]<hosts list>

Parameters:

  Tag              Value
  proxy-server  -  proxy server for use for http and/or https protocol
  bypass-list   -  a list of sites that should be visited bypassing the
                   proxy (use "<local>" to bypass all short name hosts)

Examples:

  set proxy myproxy
  set proxy myproxy:80 "<local>;bar"
  set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.foo.com"
于 2014-10-24T21:58:44.850 回答
0

这是一种粗鲁的方式,但它适用于 Win 10。

我们必须连接到自动禁用 Internet 选项 - 连接选项卡并设置代理的 VPN。使用 .bat 文件以这种方式解决:

REM Andrea & Giulio. Uno Due Sei Nove!
REM Enable Internet Option Connection Tab
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel" /v ConnectionsTab /t REG_DWORD /d 0 /f

REM Disable Proxy
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

REM Start IE to refresh values, sleep & kill
START /d "" IEXPLORE.EXE www.google.com
TIMEOUT 10
TASKKILL /IM iexplore.exe /F

TIMEOUT 10
于 2019-01-08T09:12:09.463 回答
0

要从命令行应用注册表更改以启用和禁用 Internet Explorer 中的代理,您有两种方法。

第一种方法
1 - 以管理员身份运行命令行
2 -在更改注册表之前终止 Internet Explorer 。

   Taskkill /F /IM iexplore.exe 

3 - 正如您在问题中所做的那样,从注册表更改代理启用或禁用。

第二种方式
1 - 以管理员身份运行命令行
2 - 更改代理启用/禁用,就像您在问题中所做的那样3
-终止Windows资源管理器,然后在更改注册表后重新打开

taskkill /F /IM explorer.exe && start /w /b explorer.exe
于 2018-10-11T22:35:53.677 回答