用于打开和关闭代理的 Windows 桌面小部件 [英] Windows desktop widget to turn proxy on and off

查看:75
本文介绍了用于打开和关闭代理的 Windows 桌面小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个简单的 Windows 桌面小部件来打开和关闭 Internet 代理.

I want to make a simple Windows desktop widget to turn on and off the internet proxy.

什么是更简单的方法?

推荐答案

您可以使用 Visual Basic 脚本和批处理创建一个简单的小部件".

You can create a simple "widget" using Visual Basic scripts and batchs.

示例:

proxy_off.bat

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

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

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

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

说明:

  • 在C:\Users\%USERNAME%\"中创建文件夹Proxy Settings";
  • 在C:\Users\%USERNAME%\Proxy Settings\"中创建文件夹Icons";
  • 在C:\Users\%USERNAME%\Proxy Settings\Icons"中插入on.ico"(代理On"的任何图标)和off.ico"(代理Off"的任何图标);
  • 在C:\Users\%USERNAME%\Proxy Settings\"中创建上述文件(proxy_off.bat、proxy_on.bat、change_shortcut_off.vbs、change_shortcut_on.vbs);
  • 在桌面上创建一个指向C:\Users\%USERNAME%\Proxy Settings\proxy_off.bat"的快捷方式 (Proxy.lnk);

完成!非常简单有效.现在您可以点击Proxy.lnk"(桌面上的快捷方式)来打开"和关闭"您的代理.

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

 

图标网址:http://s30.postimg.org/sgoerz0od/image.png
关闭图标网址:http://s13.postimg.org/9zha38zkj/off.png

这篇关于用于打开和关闭代理的 Windows 桌面小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆