Batch file script for Enable & disable the “use automatic Configuration Script”
up vote
1
down vote
favorite
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
setlocal ENABLEEXTENSIONS
set KEY_NAME="HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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 "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" /v AutoConfigURL /t REG_SZ /d "yyyy" /f
echo Proxy Enabled
) else (
echo Hai
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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**
Hai
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
windows script batch-file
add a comment |
up vote
1
down vote
favorite
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
setlocal ENABLEEXTENSIONS
set KEY_NAME="HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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 "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" /v AutoConfigURL /t REG_SZ /d "yyyy" /f
echo Proxy Enabled
) else (
echo Hai
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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**
Hai
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
windows script batch-file
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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
setlocal ENABLEEXTENSIONS
set KEY_NAME="HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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 "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" /v AutoConfigURL /t REG_SZ /d "yyyy" /f
echo Proxy Enabled
) else (
echo Hai
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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**
Hai
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
windows script batch-file
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
setlocal ENABLEEXTENSIONS
set KEY_NAME="HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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 "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings" /v AutoConfigURL /t REG_SZ /d "yyyy" /f
echo Proxy Enabled
) else (
echo Hai
reg add "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet 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**
Hai
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
windows script batch-file
windows script batch-file
edited Dec 8 '15 at 10:54
Hennes
58.7k792141
58.7k792141
asked Oct 16 '12 at 10:29
Tijo Joy
6112
6112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Change the line that says:
IF NOT %ValueValue%==yyyy (
to
IF NOT "%ValueValue%"=="yyyy" (
Which will make it work when %ValueValue%
is nothing.
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
add a comment |
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?
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Change the line that says:
IF NOT %ValueValue%==yyyy (
to
IF NOT "%ValueValue%"=="yyyy" (
Which will make it work when %ValueValue%
is nothing.
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
add a comment |
up vote
0
down vote
Change the line that says:
IF NOT %ValueValue%==yyyy (
to
IF NOT "%ValueValue%"=="yyyy" (
Which will make it work when %ValueValue%
is nothing.
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
add a comment |
up vote
0
down vote
up vote
0
down vote
Change the line that says:
IF NOT %ValueValue%==yyyy (
to
IF NOT "%ValueValue%"=="yyyy" (
Which will make it work when %ValueValue%
is nothing.
Change the line that says:
IF NOT %ValueValue%==yyyy (
to
IF NOT "%ValueValue%"=="yyyy" (
Which will make it work when %ValueValue%
is nothing.
answered Oct 16 '12 at 12:22
martineau
3,6011525
3,6011525
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
add a comment |
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
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
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
@Vince: Your comment has nothing to do with my answer. Suggest you move it to the question.
– martineau
Apr 22 '13 at 17:37
add a comment |
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?