LoginSignup
0
0

学校や職場にBYODでPCを持ち込む際、インターネットへの接続にProxyサーバーを経由することがある。
そのような環境と自宅を行き来する度に、Proxyの有効/無効を切り替えなければならず面倒だったためbatファイルを作成した。
デスクトップ上に配置しておけばワンクリックで切り替えることができる。

proxy_switch.bat
@echo off
set regpath="HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

for /f "tokens=3" %%A in ('reg query %regpath% /v "ProxyEnable"') do set enable=%%A

if %enable%==0x0 (
  reg add %regpath% /f /v "ProxyEnable" /t reg_dword /d 1
  echo Turn On Proxy Server
) else (
  reg add %regpath% /f /v "ProxyEnable" /t reg_dword /d 0
  echo Turn Off Proxy Server
)

同様のコードをGitHubにも公開している。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0