回复 Demon
cho. 我这里测试也是最耗时的,
但某些结论 我的xp测试结果和楼主的有出入, 也许楼 ...
plp626 发表于 2012-8-5 21:12 
原文的确有些错误,我在博客更正了,但是没有及时更新帖子,现在更新一下。
但即使更正了错误,[]/也不会比,=;还快,用for测试出来的结果是不正确的,因为在for中的echo不会触发文件搜索。
我使用的测试代码为: | Set fso = CreateObject("scripting.filesystemobject") | | set WshShell = CreateObject("wscript.Shell") | | | | s = "(=,;/\:+[]." | | | | For i = 1 To Len(s) | | c = Mid(s, i, 1) | | h = Hex(Asc(c)) | | | | With fso.OpenTextFile(h & ".bat", 2, True) | | .WriteLine "@echo off" | | .WriteLine "set s=%time%" | | For j = 1 To 100 | | .WriteLine "echo" & c | | Next | | .WriteLine "set e=%time%" | | .Write "echo echo" & c & " %s% %e%>" & h & ".txt" | | End With | | | | WshShell.Run h & ".bat", 0, True | | | | With fso.OpenTextFile(h & ".txt") | | a = Split(.ReadLine, " ") | | End With | | | | WScript.Echo a(0), TimeDiff(a(1), a(2)) | | | | fso.DeleteFile h & ".bat" | | fso.DeleteFile h & ".txt" | | Next | | | | Function TimeDiff(s, e) | | t = DateDiff("s", CDate(Left(s, 8)), CDate(Left(e, 8))) | | t = t * 1000 + (Right(e, 2) - Right(s, 2)) * 10 | | TimeDiff = t | | End FunctionCOPY |
|