Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My intention is to create a .bat file that toggles the check box of "use automatic Configuration Script" in Internet Settings.

The following is my script

@echo OFF

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

The output i'm getting for the Proxy Enabled part is

Value Name = AutoConfigURL
Value Type = REG_SZ
**Value Value =yyyy**
The operation completed successfully.
Proxy Disabled

But the Proxy Enable part isn't working fine the output i get is :

Value Name = AutoConfigURL
Value Type = REG_SZ
**Value Value =**
( was unexpected at this time.
The variable "Value Value" is not getting set when we try to do the Proxy enable
share|improve this question

1 Answer 1

Change the line that says:

IF  NOT %ValueValue%==yyyy (


IF  NOT "%ValueValue%"=="yyyy" (

Which will make it work when %ValueValue% is nothing.

share|improve this answer
Its not only disabling/enabling it. It 's changing the value in the local register meaning that any group policy upon login to the domain will be overruled. –  user218824 Apr 22 '13 at 8:44
@Vince: Your comment has nothing to do with my answer. Suggest you move it to the question. –  martineau Apr 22 '13 at 17:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.