以下脚本保存为OUD.VBS,放在C:\oud\traces,在命令行输入复制代码 来运行。运行结果示例:- Microsoft (R) Windows Script Host Version 5.8
- 版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。
-
- 31323334
复制代码 代码:- FUNCTION MRF192(FD4, DATE4, FN4) ' MOST RECENT FOLDER
- DIM F1, FSO
-
- SET FSO = CREATEOBJECT("SCRIPTING.FILESYSTEMOBJECT")
- FOR EACH F1 IN FSO.GETFOLDER(FD4).SUBFOLDERS
- IF F1.DATECREATED > DATE4 THEN
- DATE4 = F1.DATECREATED
- SET FN4 = F1
- END IF
- NEXT
-
- SET MRF192 = FN4
- END FUNCTION
-
-
- FUNCTION GETMRF
- DIM FSO, F, FC, FD4
- DIM MRF925V ' MOST RECENT FOLDER
-
- SET FSO = CREATEOBJECT("SCRIPTING.FILESYSTEMOBJECT")
- SET MRF925V = MRF192("AC", DATESERIAL(1970, 1, 1), NOTHING)
- SET MRF925V = MRF192("ADS", MRF925V.DATECREATED, MRF925V)
- SET MRF925V = MRF192("AP", MRF925V.DATECREATED, MRF925V)
- SET GETMRF = MRF925V
- END FUNCTION
-
-
- SUB FINDXML28(OUT207)
- DIM MRF925V, CMD329, WSH329
-
- SET WSH329 = CREATEOBJECT("WSCRIPT.SHELL")
- SET MRF925V = GETMRF
-
- CMD329 = "CMD /C FINDSTR /S /M 3101DF05 """ & MRF925V.PATH & "\*.xml"" > " & OUT207
- WSH329.RUN CMD329, 10, TRUE
- END SUB
-
-
- FUNCTION READ4UTF8(FPATH)
- DIM ADOS
- SET ADOS = CREATEOBJECT("ADODB.STREAM")
-
- WITH ADOS
- .CHARSET = "UTF-8"
- .TYPE = 2
- .OPEN
- .LOADFROMFILE FPATH
- READ4UTF8 = .READTEXT
- .CLOSE
- END WITH
- SET ADOS = NOTHING
- END FUNCTION
-
-
- SUB FINDHEX46(LINE40)
- DIM REGEX, MATCH, MATCHES
- SET REGEX = NEW REGEXP
- REGEX.PATTERN = "3101DF05(........)"
- SET MATCHES = REGEX.EXECUTE(READ4UTF8(LINE40))
- WSCRIPT.ECHO MATCHES(0).SUBMATCHES(0)
- END SUB
-
-
- SUB FINDHEXS(OUT207)
- DIM FSO, TS
- SET FSO = CREATEOBJECT("SCRIPTING.FILESYSTEMOBJECT")
- SET TS = FSO.OPENTEXTFILE(OUT207, 1, FALSE, TRISTATETRUE)
-
- DO UNTIL TS.ATENDOFSTREAM
- FINDHEX46 TS.READLINE
- LOOP
-
- TS.CLOSE
- END SUB
-
- SUB MAIN4
- DIM OUT207
-
- OUT207 = "OUDTMP12421.TXT"
- FINDXML28 OUT207
- FINDHEXS OUT207
- END SUB
-
- MAIN4
复制代码
|