Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9683

Batch file script for Enable & disable the "use automatic Configuration Script"

$
0
0

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 OFFsetlocal ENABLEEXTENSIONSset KEY_NAME="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"set VALUE_NAME=AutoConfigURLFOR /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" /fecho Proxy Enabled) else (echo  Haireg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v AutoConfigURL /t REG_SZ /d "" /fecho Proxy Disabled)

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

Value Name = AutoConfigURLValue Type = REG_SZ**Value Value =yyyy** HaiThe operation completed successfully.Proxy Disabled

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

Value Name = AutoConfigURLValue 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

Viewing all articles
Browse latest Browse all 9683