I want to make a simple Windows desktop widget to turn on and off the internet proxy.
What is the simpler way?
In Windows 10 it seams that after execute the script you need to open proxy settings window for changes to take effect. So add the following lines:
proxy_off.bat
echo off
cls
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
change_shortcut_on
start /min ms-settings:network-proxy
taskkill /IM SystemSettings.exe /f
exit
proxy_on.bat
echo off
cls
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
change_shortcut_off
start /min ms-settings:network-proxy
taskkill /IM SystemSettings.exe /f
exit
ATM the setting window don`t start minimized.
You can create a simple "widget" using Visual Basic scripts and batchs.
Example:
proxy_off.bat
echo off
cls
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
change_shortcut_on
exit
proxy_on.bat
echo off
cls
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
change_shortcut_off
exit
change_shortcut_off.vbs
Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("C:\Users\%USERNAME%\Desktop\Proxy.lnk")
shortcut.TargetPath = "C:\Users\%USERNAME%\Proxy Settings\proxy_off.bat"
shortcut.IconLocation = "C:\Users\%USERNAME%\Proxy Settings\Icons\on.ico"
shortcut.Save
change_shortcut_on.vbs
Set sh = CreateObject("WScript.Shell")
Set shortcut = sh.CreateShortcut("C:\Users\%USERNAME%\Desktop\Proxy.lnk")
shortcut.TargetPath = "C:\Users\%USERNAME%\Proxy Settings\proxy_on.bat"
shortcut.IconLocation = "C:\Users\%USERNAME%\Proxy Settings\Icons\off.ico"
shortcut.Save
Instructions:
Done! Very simple and effective. Now you can click on "Proxy.lnk" (the shortcut in your Desktop) to turn your proxy "On" and "Off".
Proxy On Proxy Off
On icon url: http://s30.postimg.org/sgoerz0od/image.png
Off icon url: http://s13.postimg.org/9zha38zkj/off.png