把写有IP地址的文本文件托放在这个VBS上,它会自动处理并且由你来确定N的大小,如果不输入N的话,它就自动递增那个后面的尾数,从0开始。
建议用这个VBS,容错要比bat好多了。
'BY Coo_boi
If WScript.Arguments.Count=0 Then WScript.Quit
N=InputBox("循环计数长度N","IP处理")
If Not IsNumeric(N) Then WScript.Quit
Dim fso,txt,IPtxt
Set fso=CreateObject("Scripting.FileSystemObject")
Set txt=fso.OpenTextFile(WScript.Arguments(0),1)
tmp=txt.ReadAll
txt.Close
Set IPtxt=fso.CreateTextFile(WScript.Arguments(0),True)
i=0
For Each tmpLine In Split(tmp,vbCrLf)
If tmpLine<>"" then
IPtxt.WriteLine tmpLine&"-"&i
If i=N Then
i=0
Else
i=i+1
End if
End If
Next
IPtxt.Close
WScript.Echo "All Work Is Done."