手机
当前位置:查字典教程网 >脚本专栏 >vbs >一个扩展时间段的dir命令的vbs脚本
一个扩展时间段的dir命令的vbs脚本
摘要:setArg=Wscript.ArgumentsIfArg.Count=0thenWscript.echochr(9)&chr(9)&spa...

setArg=Wscript.Arguments

IfArg.Count=0then

Wscript.echochr(9)&chr(9)&space(4)&"Xdirv0.1"

Wscript.echo""

Wscript.echochr(9)&"cscriptdir.vbspathtime1time2ext"

Wscript.echochr(9)&"cscriptdir.vbsd:test2008010120080430doc"

Wscript.Quit

EndIf

Path=Arg(0)

Time1=Arg(1)

Time2=Arg(2)

Ext=Arg(3)

FileTotal=0

DirTotal=0

FileTotalsize=0

TimeSpend=Timer

myFindPath

TimeSpend=round(Timer-TimeSpend,2)

txtResult="搜索完成!"&vbCrLf&"共找到文件:"&FileTotal&"个."&vbCrLf&"共搜索目录:"&DirTotal&"个."&vbcrlf&"文件总数大小"&FormatNumber(FileTotalsize/1024,0)&"kB"&vbCrLf&"用时:"&TimeSpend&"秒."

wscript.echotxtResult

SubmyFind(ByValthePath)

Dimfso,myFolder,myFile,curFolder

Setfso=wscript.CreateObject("scripting.filesystemobject")

SetcurFolders=fso.getfolder(thePath)

DirTotal=DirTotal+1

IfcurFolders.Files.Count>0Then

ForEachmyFileIncurFolders.Files

IfInStr(1,LCase(Fso.GetExtensionName(myFile.Name)),ext)>0AndGtime(myFile.DateCreated)>Time1AndGtime(myFile.DateCreated)<Time2Then

wscript.echoFormatPath(thePath)&""&myFile.Name

FileTotal=FileTotal+1

FileTotalsize=FileTotalsize+myFile.size

EndIf

Next

EndIf

IfcurFolders.subfolders.Count>0Then

ForEachmyFolderIncurFolders.subfolders

myFindFormatPath(thePath)&""&myFolder.Name

Next

EndIf

EndSub

FunctionFormatPath(ByValthePath)

thePath=Trim(thePath)

FormatPath=thePath

IfRight(thePath,1)=""ThenFormatPath=Mid(thePath,1,Len(thePath)-1)

EndFunction

FunctionGtime(str)

str=FormatDateTime(str,2)

str1=Split(str,"-",-1,1)

Iflen(str1(1))=1thenstr11="0"&str1(1)

Iflen(str1(2))=1thenstr12="0"&str1(2)

Gtime=str1(0)&str11&str12

EndFunction

【一个扩展时间段的dir命令的vbs脚本】相关文章:

用vbs删除某些类型文件和磁盘空间报告的脚本

一个把任何文件转成批处理的vbs脚本Any2Bat.vbs

用VBS检测Guest状态的脚本

禁止QQ上网的vbs脚本代码

使用 Adsutil.vbs iis管理脚本

一个可以更换windows xp or 2003的序列号的vbs脚本

可以定时自动关机的vbs脚本

用VBS修改(设置)系统时间和日期的代码

定时自动备份IIS的WWW日志的vbs脚本

利用vbscript的for命令实现定时关机

精品推荐
分类导航