Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

protected by bwDraco Jul 3 '15 at 17:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .