How to toggle 'Use Automatic Configuration script' checkbox in IE settings without clearing the proxy URL?

丶灬走出姿态 提交于 2021-01-29 11:51:02

问题


I need to switch on the proxy to use internet and switch it off for office intranet. Manually it is tiresome. The proxy does not change. How to just toggle the check box using bat file? If the status is enabled it will disable and if disable it will enable. Nothing much. Don't want to clear the proxy string. Just enabling/disabling the checkbox.


回答1:


As far as I know, generally, toggle the 'Use Automatic Configuration script' checkbox will not clear the proxy server address. But it might clear the Address under the 'Use Automatic Configuration script' checkbox, so, I suppose you want to keep the Address when toggle the 'Use Automatic Configuration script' checkbox. If that is the case, please check the following steps:

After adding the Address from IE setting, please refer to the following steps to check the registry setting about the Use Automatic Configuration script Setting, and get the DefaultConnectionSettings data (the data contain the address):

  1. Open Regedit
  2. Navigate to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections
  3. check the "DefaultConnectionSettings"

    The 9th bit of this key controls the setting.

    01 - Nothing is checked ("Automatically detect settings" or "Use automatic configuration script")

    05 - Only "Use automatic configuration script" is checked

    09 - Only "Automatically detect settings" is checked

    0d - Both are checked

    After adding the Address under the "Use automatic configuration script", we can see the DefaultConnectionSettings data contains the address, please check the following screenshot:

  4. Modify above data and close Internet Explorer, and then open the IE browser again to verify the change has taken effect.

To checked/unchecked the "Use automatic configuration script", we could run the following commands using the Command Prompt to change the setting.

Unchecked the option and keep address:

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v "DefaultConnectionSettings" /t REG_BINARY /d "460000000400000009000000000000000000000026000000687474703A2F2F7777772E78787878782E636F6D3A313233342F73616D706C6553637269707400000000000000000000000000000000"

Checked the checkbox and set address:

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v "DefaultConnectionSettings" /t REG_BINARY /d "46000000040000000d000000000000000000000026000000687474703A2F2F7777772E78787878782E636F6D3A313233342F73616D706C6553637269707400000000000000000000000000000000"

Edit:

You could also use a bat file with the above command, like this:

@echo off

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v "DefaultConnectionSettings" /t REG_BINARY /d "46000000040000000d000000000000000000000026000000687474703A2F2F7777772E78787878782E636F6D3A313233342F73616D706C6553637269707400000000000000000000000000000000"

Besides, if you want to set the Proxy Server Address via the DefaultConnectionSettings key, please refer to the following command (you could check the DefaultConnectionSettings data from the Registry):

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v "DefaultConnectionSettings" /t REG_BINARY /d "46000000090000000F000000100000007777772E78787878782E636F6D3A38300000000026000000687474703A2F2F7777772E78787878782E636F6D3A313233342F73616D706C6553637269707400000000000000000000000000000000"

After running above command, the result like this:



来源:https://stackoverflow.com/questions/60946638/how-to-toggle-use-automatic-configuration-script-checkbox-in-ie-settings-witho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!