Peter
Peter

Reputation: 33

Refresh Internet Options via Batch/CMD

I made a batch program to enable and disable proxy use in Internet Options using the following code:

[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 

This code works fine, but in order to apply the changes and connect to internet using the proxy, I have to close and reopen my browser. Is there a way to apply the proxy with out doing so.

I have already try "ipconfig /renew" and "ipconfig /release". I have also tryed to disabling and enabling my local area connection.

If know of another way to connect to a proxy via batch/cmd or another program and doesn't have this problem that would help too.

Upvotes: 3

Views: 3476

Answers (3)

funcool
funcool

Reputation: 11

This is a rude way but it works on Win 10.

We have to connect to a VPN that automatically disable the Internet Option - Connection Tab and set a Proxy. Solved this way, with a .bat file:

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

Upvotes: 0

hollopost
hollopost

Reputation: 587

To apply change in registry for enable and disable the proxy in Internet Explorer from command line you have Two way.

First way:
1- Run command line As Administrator
2- Terminate Internet Explorer before change your registry.

   Taskkill /F /IM iexplore.exe 

3- change the proxy enable or disable from registry as you did in your question.

Second Way :
1- Run command line as administrator
2- Change proxy enable/disable as you did in your question
3- Terminate the windows Explorer and then Reopen after you change registry Already

taskkill /F /IM explorer.exe && start /w /b explorer.exe

Upvotes: 0

triggeradeadcat
triggeradeadcat

Reputation: 121

I don't use a proxy so this is blank for me but this command seems to be what you want.

netsh winhttp ?

displays help about setting proxies etc.

This is help on setting a proxy

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"

Upvotes: 0

Related Questions