0

In a batch script, I am updating a registry value with the REG command to disable the manual proxy.

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

However, this does not take effect until I open the proxy settings page in Windows (Start Menu > Change Proxy Settings). All I have to do is open the page and the property gets updated correctly.

Is there any way to reload/update this setting without opening the network settings?

JayD
  • 23

4 Answers4

1

This link suggests that it cannot be done: https://superuser.com/a/944980/916597.

Unfortunately, there is no easy way. As you’ve noticed, you’re missing the magic “read those settings now” command:

Note that in the link, the answer mentions that there is possibly a way to do it in PowerShell, but that doesn't answer this question. If it interests you, though, go check it out.

JayD
  • 23
0

I had the same issue when enabling/disabling a proxy using a vbs script.

I just added this:

Shell.run "ms-settings:network-proxy"

WScript.Sleep 1000

Shell.Run "taskkill /f /im SystemSettings.exe", , True

it opens the proxy settings, waits 1 second and then closes it. This will ensure that your proxy changes are working.

0

I have created simple CLI tool which force reload IE proxy settings. It calls WININET.DLL InternetSetOption function as described here: https://superuser.com/a/944980/916597

Download it from here: https://gofile.io/?c=ol4zE7

Tested on W7 and W10.

0

Need to force system settings update, iexplore do it for you:

REM Enable-Disable System Proxy in one file

@echo off

SET home_key="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

FOR /F "tokens=3" %%L IN ('reg query %home_key% /v ProxyEnable' ) DO SET currentProxy=%%L

IF %currentProxy% == 0x1 goto turnoff

IF %currentProxy% == 0x0 goto turnon

:turnoff

reg add %home_key% /v ProxyEnable /t REG_DWORD /d 0 /f

SET proxy="Proxy disabled"

goto EOF

:turnon

reg add %home_key% /v ProxyEnable /t REG_DWORD /d 1 /f

SET proxy="Proxy enabled"

goto EOF

:EOF REM Restart Internet Explorer to changes take efect

start /w /b iexplore.exe

timeout 2 /nobreak

taskkill /f /im iexplore.exe

echo %proxy%