Windows script to toggle automatic configuration script checkbox without removing any existing string value

29,890

I know this is an old question, but it was not so easy for me to find a solution so I want to share what I found with you just in case you land in this page.

In the RegKey HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections the 9th value of DefaultConnectionSettings store the flag of:

  • Automatically detect settings
  • Use Automatic Configuration script

Available values:
01 - neither of those 2 auto config boxes are checked
05 - just the Use automatic configuration script is checked
09 - just the Automatically detect settings is checked
0d - both of them are checked

Personally I exported the current key, I created a copy and modified it with the text editor.

Then on needs I load through Command Line the initial RegKey or the modified one through command reg import KeyIWantToUse.reg

Thanks to Jamie Google Group And to Leo on StackOverflow that helped me a lot.

Share:
29,890

Related videos on Youtube

Adam
Author by

Adam

Updated on September 18, 2022

Comments

  • Adam
    Adam over 1 year

    I'm trying to create a bat file to toggle the automatic configuration script checkbox in Internet Explorer (see red box in screenshot)...but without removing any existing value in the related textbox (see green box in screenshot). enter image description here

    I checked here: Batch file script for Enable & disable the "use automatic Configuration Script"

    But that script a) removes existing values and b) seems to only disable he checkbox and never enable it.

    @echo OFF
    
    setlocal ENABLEEXTENSIONS
    set KEY_NAME="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
    set VALUE_NAME=AutoConfigURL
    
    FOR /F "usebackq skip=1 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
        set ValueName=%%A
        set ValueType=%%B    
        set ValueValue=%%C
    )
    
    @echo Value Name = %ValueName%
    @echo Value Type = %ValueType%
    @echo Value Value = %ValueValue%
    
    IF  NOT "%ValueValue%"=="yyyy" (
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "yyyy" /f
    echo Proxy Enabled
    ) else (
    echo  Hai
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "" /f
    echo Proxy Disabled
    )
    
    pause
    

    What am I missing here?

  • Yumi Koizumi
    Yumi Koizumi over 3 years
    The value is hanged, but it does not affect the checked box (does not uncheck it)... Win10