溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么用vbs實現(xiàn)自動檢查代理是否可用

發(fā)布時間:2021-09-02 21:23:59 來源:億速云 閱讀:264 作者:chen 欄目:開發(fā)技術(shù)

本篇內(nèi)容介紹了“怎么用vbs實現(xiàn)自動檢查代理是否可用”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!

將下面代碼中的地址改一下,存為ieproxy.vbs,然后在文件上點右鍵,選擇“在命令提示符中打開”
不多說了,存下來看看吧!

復(fù)制代碼 代碼如下:

strMachines = "24.11.246.125:2406;61.252.60.30:68660;64.161.10.2:3128;65.23.157.55:80;66.229.103.146:5089;68.6.240.207:2521;68.103.105.108:2384;70.160.84.18:2332;71.74.23.52:2220;71.207.239.136:2653;72.187.78.76:2413;76.177.94.222:2569;122.103.185.182:8080;122.197.130.107:2556;128.8.126.111:3128;128.8.126.112:3128;128.112.139.71:3124;128.112.139.71:3128;128.112.139.71:68660;128.119.247.210:8888;128.119.247.211:3128;128.208.4.197:8888;128.208.4.198:3124;128.227.56.82:3128;128.252.19.20:68660;129.24.17.70:3128;129.186.205.77:3128;129.237.161.193:8888;129.237.161.194:8888;138.23.204.133:3124;140.247.60.123:8888;140.247.60.126:8888;160.36.57.173:8888;165.228.129.10:3128;165.228.132.10:3128;169.229.50.3:3128;169.229.50.5:3128;169.229.50.12:3124;169.229.50.12:3128;169.229.50.12:68664;199.89.182.6:80;203.178.133.2:3128;203.178.133.3:3124;203.178.133.3:3128;203.178.133.11:68660;203.198.162.124:8080;206.207.248.34:3124;206.207.248.34:3128;209.197.110.17:80;210.20.67.152:8080;210.125.84.16:3128;216.104.190.179:80;218.5.79.200:80;218.58.136.14:808;221.152.139.220:8080;59.186.67.28:8080;125.142.138.208:2613;210.76.97.79:80;218.152.54.154:8080;12.218.111.15:2356;24.222.80.248:2574;58.71.35.206:8080;60.190.99.218:19759;61.86.48.162:8080;61.252.60.30:3124;61.252.60.30:3128;62.231.243.136:66;62.231.243.137:66;67.164.134.61:2426;67.165.179.84:2495;74.122.236.78:2510;74.129.4.44:2251;76.98.35.94:2303;76.210.118.129:2533;81.211.88.94:3128;82.77.21.83:2263;85.82.145.250:8080;85.214.37.22:3128;122.47.159.72:2400;128.8.126.111:68660;128.10.19.53:8888;128.31.1.11:8888;128.31.1.13:8888;128.31.1.14:3128;128.114.63.14:3124;128.119.247.211:3124;128.238.88.64:3124;128.238.88.65:3128;129.12.3.75:3124;129.82.12.188:8888;129.186.205.77:3124;129.240.67.15:3124;129.240.67.15:3128;129.242.19.197:3124;130.37.198.244:3128;130.37.198.244:68664;132.252.152.193:3124;132.252.152.194:3124;132.252.152.194:3128" 
aMachines = split(strMachines, ";") 
For Each machine2 in aMachines 
    machinearr = split(machine2, ":") 
    machine = machinearr(0) 
    Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ 
        ExecQuery("select * from Win32_PingStatus where address = '"_ 
            & machine & "'") 
    For Each objStatus in objPing 
        If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then  
            WScript.Echo(machine2 & " is not reachable")  
        else 
             WScript.Echo(machine2 & " is OK")  
             if confirm("設(shè)置代理為"& machine2 &"?") then 
                msgbox SetIEProxy(1,machine2) 
             end if 
        End If 
    Next 
Next 
function confirm(s) 
    confirm = (msgbox(s,vbYesNo,s) = 6) 
end function 
Function SetIEProxy(ProxyEnable,ProxyIP) 
    On Error Resume Next 
    Const HKEY_CURRENT_USER = &H80000001 
    strComputer = "." 
    Set objReg = GetObject("winmgmts:" _ 
        & "{impersonationLevel=impersonate}\\" & strComputer & _ 
            "\root\default:StdRegProv") 
    strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" 
    strEntryName = "ProxyEnable" 
    dwvalue = ProxyEnable 
    objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strEntryName,dwValue 
    strEntryName = "ProxyServer" 
    dwvalue = ProxyIP 
    objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, strEntryName,dwValue 
    If Err = 0 Then 
        SetIEProxy = True 
    Else 
        SetIEProxy = False 
    End If 
End Function 
msgbox "ok"

“怎么用vbs實現(xiàn)自動檢查代理是否可用”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

vbs
AI