Created
October 3, 2014 09:47
-
-
Save miglen/7e5e07f18b075e464c8c to your computer and use it in GitHub Desktop.
This is simple script which is using the Windows registry files to modify (disable/enable) the HP (or any other given) proxy. I find it annoying whenever I need to disable my proxy to go to my Internet settings and click like 10 times.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem HP Proxy switch on/off | |
rem Author: Miglen Evlogiev <code@miglen.com> | |
rem Date: 3/10/2014 | |
rem Version: 0.1 | |
setlocal ENABLEEXTENSIONS | |
set KEY_NAME=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings | |
set VALUE_NAME=AutoConfigURL | |
set HP_PROXY=http://autocache.hp.com/ | |
set TCO=5 | |
for /F "usebackq skip=2 tokens=1-3" %%A IN (`reg query "%KEY_NAME%" /v "%VALUE_NAME%" `) do ( | |
rem Echo A %%A | |
rem Echo B %%B | |
rem Echo C %%C | |
IF [%%C]==[] ( | |
Echo | |
Echo There is NO proxy set! | |
Echo Setting HP Proxy [%HP_PROXY%] | |
reg add "%KEY_NAME%" /v "%VALUE_NAME%" /t REG_SZ /d "%HP_PROXY%" /f | |
Echo DONE! | |
timeout %TCO% | |
goto exit | |
) | |
Echo | |
Echo You have the following proxy set: %%C | |
Echo Disabling proxy settings... | |
reg add "%KEY_NAME%" /v "%VALUE_NAME%" /t REG_SZ /d "" /f | |
Echo DONE! | |
timeout %TCO% | |
rem echo %%A | |
) | |
:exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment