加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

修改代理服务器

发布时间:2020-12-17 08:00:38 所属栏目:百科 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 Const HKCU=H80000001 'HKEY_CURRENT_USERConst HKLM=H80000002 'HKEY_LOCAL_MACHINEConst REG_SZ=1Const REG_EXPAND_SZ=2Const REG_BINARY=3Const RE

以下代码由PHP站长网 52php.cn收集自互联网

现在PHP站长网小编把它分享给大家,仅供参考

Const HKCU=&H80000001 'HKEY_CURRENT_USER
Const HKLM=&H80000002 'HKEY_LOCAL_MACHINE

Const REG_SZ=1
Const REG_EXPAND_SZ=2
Const REG_BINARY=3
Const REG_DWORD=4
Const REG_MULTI_SZ=7

Const HKCU_IE_PROXY = "SoftwareMicrosoftWindowsCurrentVersionInternet
Settings"

Set oReg=GetObject("winmgmts:!root/default:StdRegProv")

Main

Sub Main()

' If Proxy is set then turn it off
If GetValue(HKCU,HKCU_IE_PROXY,"ProxyEnable",REG_DWORD) = 1 AND
Len(GetValue(HKCU,"ProxyServer",REG_SZ)) > 0 Then
CreateValue HKCU,REG_DWORD
wscript.echo "Proxy Disabled"
Else
' If Proxy is not set then turn it on

strProxyServer = "MyProxySvr:80"
strProxyOveride = "*.domain.com;*.domain2.com;*domain3.com"

CreateValue HKCU,strProxyServer,REG_SZ
CreateValue HKCU,1,REG_DWORD
CreateValue HKCU,"ProxyOverride",strProxyOveride,REG_SZ
wscript.echo "Proxy Enabled" & vbcrlf & "(" & strProxyServer & ")"
End If

End Sub

Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
Select Case KeyType
Case REG_SZ
CreateValue = oReg.SetStringValue(Key,Value)
Case REG_EXPAND_SZ
CreateValue =
oReg.SetExpandedStringValue(Key,Value)
Case REG_BINARY
CreateValue = oReg.SetBinaryValue(Key,Value)
Case REG_DWORD
CreateValue = oReg.SetDWORDValue(Key,Value)
Case REG_MULTI_SZ
CreateValue =
oReg.SetMultiStringValue(Key,Value)
End Select
End Function

Function DeleteValue(Key,ValueName)
DeleteValue = oReg.DeleteValue(Key,ValueName)
End Function

Function GetValue(Key,KeyType)

Dim Ret

Select Case KeyType
Case REG_SZ
oReg.GetStringValue Key,Value
Ret = Value
Case REG_EXPAND_SZ
oReg.GetExpandedStringValue Key,Value
Ret = Value
Case REG_BINARY
oReg.GetBinaryValue Key,Value
Ret = Value
Case REG_DWORD
oReg.GetDWORDValue Key,Value
Ret = Value
Case REG_MULTI_SZ
oReg.GetMultiStringValue Key,Value
Ret = Value
End Select

GetValue = Ret
End Function

以上内容由PHP站长网【52php.cn】收集整理供大家参考研究

如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读