- Set fso = CreateObject("Scripting.FileSystemObject")
- text = fso.OpenTextFile("d:\1.txt",1).ReadAll
-
- Pattern1 = "(主机名:|\bOS (名称|版本)|初始安装日期" & _
- "|系统(启动时间|制造商|型号)|物理内存总量|域:).*"
- Pattern2 = "(Windows IP 配置|(IPV4 |物理)地址|子网掩码|默认网关).*"
- Pattern3 = "DNS 服务器.*"& vbCrLf & ".*"
-
- With New RegExp
- .Pattern = Pattern1 & "|" & Pattern2 & "|" & Pattern3
- .Global = True
- .Ignorecase = True
- For Each a in .Execute(text)
- str = str & a & vbCrLf
- Next
- End with
-
- fso.CreateTextFile("d:\2.txt",True).Write str
- MsgBox "OK"
复制代码 vbs试试? |