
下記のレジストリの状態を確認して判断するバッチファイルです。
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
ProxyEnable? REG_DWORD 0x0
パイプ(半角の”|”)を通して”find”コマンドに送り、”0x0″があるかどうかで、”ERRORLEVEL”を判定すると良いと思います。(”find”コマンドは、指定した文字列が見つかれば、”ERRORLEVEL”に0を、見つからなければ1を返します。)
@echo off
reg query “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings” /v ProxyEnable | find “0x0”
if %ErrorLevel%==1 goto Set_0
if %ErrorLevel%==0 goto Set_1
:Set_1
reg add “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings” /f /v ProxyEnable /t reg_dword /d 1
goto :eof
:Set_0
reg add “HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings” /f /v ProxyEnable /t reg_dword /d 0
goto :eof