本帖最后由 czjt1234 于 2013-5-5 08:56 编辑
花了n分钟,把代码缩进了一下- On Error Resume Next
- dim k,m,a,b,b1,d1
- dim t1,t2,t3,t4,t5,t6
-
- t4=inputbox("请指定删除系统垃圾的时间(格式为xx:xx:xx: ) ")
- if t4<>""then
- t5=cdate(t4)
- t2=inputbox("请指定删除系统垃圾的日期(格式是xxxx年/xx月/xx日)")
- if t2<>" "then
- t3=cdate(t2)
- t1=date
- if t3=t1 then
- do
- t6=time
- wscript.sleep 500
- loop until t6=t5
- if t6=t5 then
- set s1=wscript.createobject("wscript.shell")
- bianli("c:\")
- if m<>0 then
- s1.popup "共删除了"&m&"个系统垃圾文件",2,"提示",64
- end if
- end if
- end if
- end if
- end if
-
- function bianli(spath)
- set ofso=createobject("scripting.filesystemobject")
- set ofolder=ofso.getfolder(spath)
- set osubfolders=ofolder.subfolders
- set ofiles=ofolder.files
-
- for each ofile in ofiles
- b=ofile.name
- k=lcase(right(b,3))
- if k="tmp" or k="log" or k="gid" or k="chk" or k="old" or k="bak" then
- ofso.deletefile(ofile)
- m=m+1
- end if
- next
-
- for each osubfolder in osubfolders
- b1=osubfolder.path
- bianli(osubfolder.path)
- next
-
- set ofolder=nothing
- set osubfolders=nothing
- set ofso=nothing
- end function
复制代码 确实很垃圾的代码
注意加了wscript.sleep 500延时就不占cpu了 |