How to force update to proxy setting after changing registry values in batch script?

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

Posted 2018-06-21T13:11:08.453

Reputation: 23

Have you tried rebooting the machine ? If so you may reboot it in the batch file as well, and if you’re on a domain I suggest you make use of the group policy and maybe if you change the registers values whole the pc is signed out ( remotely ) then the user who signs in gets the settings. – Elie – 2018-06-21T14:10:06.910

The registry is updated when you run the command, the program has no clue until you open that settings window and it checks the registry for that setting. – Moab – 2018-06-21T14:19:24.127

@Elie No, I've not tried rebooting and although I'm quite confident that would sufficiently update the variable, it is not really an option for me either. Group policy won't work because I'm only a local admin. – JayD – 2018-06-21T15:13:48.040

@Moab Yes, that is essentially my question: how to update "the program" from within my batch script? I've edited the misleading title. – JayD – 2018-06-21T15:15:04.553

Answers

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

Posted 2018-06-21T13:11:08.453

Reputation: 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.

bewstaf

Posted 2018-06-21T13:11:08.453

Reputation: 1

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.

svmPavouk

Posted 2018-06-21T13:11:08.453

Reputation: 1