首页脚本一个扩展时间段的dir命令的vbs脚本

一个扩展时间段的dir命令的vbs脚本

时间2024-02-11 09:24:03发布访客分类脚本浏览683
导读:收集整理的这篇文章主要介绍了一个扩展时间段的dir命令的vbs脚本,觉得挺不错的,现在分享给大家,也给大家做个参考。 核心代码set arg=Wscript.arguments If A...
收集整理的这篇文章主要介绍了一个扩展时间段的dir命令的vbs脚本,觉得挺不错的,现在分享给大家,也给大家做个参考。

核心代码

set arg=Wscript.arguments If Arg.Count=0 then Wscript.echo chr(9)&
    chr(9)&
    space(4)&
    "Xdir v0.1" Wscript.echo "" Wscript.echo chr(9)&
    "cscript dir.vbs path time1 time2 ext" Wscript.echo chr(9)&
    "cscript dir.vbs d:\test 20080101 20080430 doc" Wscript.QuIT End If Path=Arg(0) Time1=Arg(1) Time2=Arg(2) Ext=Arg(3) Filetotal = 0 DirTotal = 0 FileTotalsize=0 TimeSPEnd = Timer myFind Path TimeSpend = round(Timer - TimeSpend,2) txtResult = "搜索完成!" &
     vbCrLf &
     "共找到文件:" &
     FileTotal &
     "个." &
     vbCrLf &
     "共搜索目录:" &
     DirTotal &
     "个." &
    vbcrlf&
    "文件总数大小"&
    FormatNumber(FileTotalsize/1024,0)&
    "kB"&
     vbCrLf &
     "用时:" &
     TimeSpend &
     "秒." wscript.echo txtResult Sub myFind(ByVal thePath)   Dim fso, myFolder, myFile, curFolder Set fso = wscript.CreateObject("scripting.fileSystemobject") Set curFolders = fso.getfolder(thePath) DirTotal = DirTotal + 1 If curFolders.Files.Count >
     0 Then For each myFile In curFolders.Files If InStr(1, LCase(Fso.GetExtensionName(myFile.Name)), ext) >
     0 And Gtime(myFile.DateCreated) >
    Time1 And Gtime(myFile.DateCreated)Time2 Then wscript.echo FormatPath(thePath) &
     "\" &
     myFile.Name FileTotal = FileTotal + 1 FileTotalsize = FileTotalsize + myFile.size End If Next End If   If curFolders.subfolders.Count >
     0 Then For Each myFolder In curFolders.subfolders myFind FormatPath(thePath) &
     "\" &
     myFolder.Name  Next End If End Sub Function FormatPath(ByVal thePath) thePath = Trim(thePath) FormatPath = thePath If Right(thePath, 1) = "\" Then FormatPath = Mid(thePath, 1, Len(thePath) - 1) End Function Function Gtime(str) str=FormatDateTime(str,2) str1=Split(str,"-",-1,1) If len(str1(1))=1 then str11="0"&
    str1(1) If len(str1(2))=1 then str12="0"&
    str1(2) Gtime=str1(0)&
    str11&
    str12 End Function 

这篇文章就介绍到这,希望大家以后多多支持。

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 一个扩展时间段的dir命令的vbs脚本
本文地址: https://pptw.com/jishu/609615.html
使用vbs下载文件的代码加强版 用vbs实现的exe2swf工具脚本代码

游客 回复需填写必要信息