經過幾天的研究。我想出了劇本。答案如下:
Dim strAllIP, strUsedIP, strAvailableIps
Dim ynum, xnum, counter, outercounter
ynum = 0
xnum = 0
counter = 0
outercounter = 0
strAllIP = Array("192.168.1.1","192.168.1.2","192.168.1.3", _
"192.168.1.4","192.168.1.5","192.168.1.6", _
"192.168.1.7","192.168.1.8","192.168.1.9", _
"192.168.1.10","192.168.1.11","192.168.1.12", _
"192.168.1.13", "192.168.1.14")
strUsedIP = Array("192.168.1.1","192.168.1.2")
For each i in strAllIP
For each j in strUsedIP
If i = j Then
Exit For
End if
counter = counter + 1
If counter - 1 = Ubound(strUsedIP) Then
Match = True
Exit for
End if
Next
counter = 0
If match = True Then
Redim preserve newarray(outercounter)
newarray(outercounter)= i
outercounter = outercounter + 1
End if
Match = False
Next
strAvailableIps = join(newarray,chr(13))
msgbox strAvailableIps,0,"Available IPs"
爲什麼VBScript?你是把它寫成一個應用程序還是一個網頁腳本? – 2011-05-10 19:10:26
不適用於網頁。我正在爲終端客戶端SecureCRT編寫腳本。直到最近,這是你不得不使用,所以我學到了VBScript。它現在支持python,但我還不太瞭解它。 – Onat 2011-05-10 19:34:14