VBS常用代码合集.doc

VBS常用代码合集.doc

ID:52514275

大小:140.00 KB

页数:51页

时间:2020-03-28

VBS常用代码合集.doc_第1页
VBS常用代码合集.doc_第2页
VBS常用代码合集.doc_第3页
VBS常用代码合集.doc_第4页
VBS常用代码合集.doc_第5页
资源描述:

《VBS常用代码合集.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、VBS常用代码合集(个人整理)从系统开始菜单中删除此链接:复制代码代码如下:WindowsRegistryEditorVersion5.00[HKEY_CLASSES_ROOT/CLSID/{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}]@=-"InfoTip"=-[HKEY_CLASSES_ROOT/CLSID/{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}/DefaultIcon]@=-[HKEY_CLASSES_ROOT/CLSID/{2559a1f6-21d7-11d4-bdaf-00c04f60b9f0}/Instan

2、ce/InitPropertyBag]"Command"=-"Param1"=-VBS脚本实现整理磁盘碎片功能SetWshShell=WScript.CreateObject("WScript.Shell")Dimfso,d,dcSetfso=CreateObject("Scripting.FileSystemObject")Setdc=fso.DrivesForEachdindcIfd.DriveType=2ThenReturn=WshShell.Run("defrag"&d&"-f",1,TRUE)EndIfNextSetWshShell=Nothing计划任务定时调用VBS脚本复制

3、代码代码如下:OptionExplicitOnErrorResumeNext'生成列表的文件类型ConstsListFileType="wmv,rm,wma"'文件所在的相对路径ConstsShowPath="."'排序类型的常量定义ConstiOrderFieldFileName=0ConstiOrderFieldFileExt=1ConstiOrderFieldFileSize=2ConstiOrderFieldFileType=3ConstiOrderFieldFileDate=4'排序顺逆的常量定义constiOrderAsc=0constiOrderDesc=1'生成列表的文件

4、数量constiShowCount=20'显示的日期格式函数FunctionCndate2(date1,intDateStyle)dimstrdate,dDate1strdate=cstr(date1)IfIsdate(strdate)ThenIfLeft(cstr(strdate),1)="0"ThendDate1=Cdate("20"+cstr(strdate))elsedDate1=Cdate(strdate)EndIfElsedDate1=Now()EndIfSelectcaseintDateStyleCase1:Cndate2=Cstr(Year(dDate1))+"-"+Cs

5、tr(Month(dDate1))+"-"+Cstr(Day(dDate1))Case2:Cndate2=Cstr(Month(dDate1))+"-"+Cstr(Day(dDate1))Case3:Cndate2=Cstr(Month(dDate1))+"月"+Cstr(Day(dDate1))+"日"Case4:Cndate2=Cstr(year(dDate1))+"年"+Cstr(Month(dDate1))+"月"+Cstr(Day(dDate1))+"日"EndSelectEndFunctionFunctionListFile(strFiletype,intCompare,in

6、tOrder,intShowCount)DimsListFileDimfso,f,f1,fc,s,ftype,fcount,i,j,kDimt1,t2,t3,t4,t5DimiMonth,iDaysListFile=""Setfso=CreateObject("Scripting.FileSystemObject")Setf=fso.GetFolder(sShowPath)Setfc=f.Filesfcount=fc.countredimarrFiles(fcount,5)redimarrFiles2(fcount,5)i=0'排序ForEachf1infcftype=right(f1.

7、name,len(f1.name)-instrrev(f1.name,"."))arrFiles(i,0)=f1.namearrFiles(i,1)=ftypearrFiles(i,2)=f1.sizearrFiles(i,3)=f1.typearrFiles(i,4)=f1.DateLastModifiedi=i+1NextFori=0tofcount-1forj=i+1tofcount-1selectCaseintCompare

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。