清除垃圾的VBS文件 自動查找多個盤
更新時間:2009年09月05日 17:20:22 作者:
可以刪除.tmp ._mp .log .gid .chk .old file文件和
temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files"文件夾。
復(fù)制代碼 代碼如下:
rem made by correy
rem made at 2007.9.22
rem it can be delete you computer's the follow things(except cd,dvd)
rem it can be delete empty file and folder
rem it can be delete .tmp ._mp .log .gid .chk .old file
rem it can be delete temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files" folder.
rem i am thinking how to delete the same size and same name's file and folder
On Error GoTo 0
Set fso = CreateObject("Scripting"&"."&"FileSystem"&"Object")
for n = 1 to 3
For Each d in fso.Drives
if d.drivetype=4 then
Exit For
else
scan(d)
end if
next
next
sub scan(folder)
on error resume next
set folder=fso.getfolder(folder)
for each file in folder.files
if file.size=0 then
file.delete(true)
end if
ext=fso.GetExtensionName(file)
ext=lcase(ext)
if ext="tmp" or ext="_mp" or ext="log" or ext="gid" or ext="chk" or ext="old" then ''30
file.delete(true)
end if
next
for each subfolder in folder.subfolders
rem instrRev() can't be used,i want to find "\".
if left(subfolder.path,4)="temp" or left(subfolder.path,8)="recycled" then
subfolder.delete(true)
elseif left(subfolder.path,6)="recent" or left(subfolder.path,7)="cookis" then
subfolder.delete(true) rem 40
elseif left(subfolder.path,24)="Temporary Internet Files" or left(subfolder.path,8)="prefetch" then
subfolder.delete(true)
end if
if subfolder.size=0 then subfolder.delete(true)
scan(subfolder)
next
end sub
相關(guān)文章
VBScript 算一算你從出生到現(xiàn)在共計多少天
VBScript 算一算你從出生到現(xiàn)在共計多少天,呵呵,努力奮斗吧2009-11-11利用VBS腳本修改聯(lián)想筆記本BIOS密碼的代碼分享
這篇文章主要介紹了利用VBS腳本修改聯(lián)想筆記本BIOS密碼的實(shí)現(xiàn)代碼,感覺這不科學(xué)!無意中找到的一些資料,喜歡的朋友可以試試2013-07-07vbs下用一個小方法實(shí)現(xiàn)批量添加域用戶
在域模式下批量添加域用戶就有些困難,下面是一個vbs腳本,在同級目錄下用放置一個users.txt的文本文檔,格式:username,password,在dc上運(yùn)行該腳本,即可以將users.txt的用戶信息批量添加到ad里面。可以通過移動或拖拽的方法,將生成的用戶移動到ou下面,以保證ou的組策略及文件夾重定向?qū)υ撚脩羯А?2008-06-06vbs腳本實(shí)現(xiàn)下載jre包并靜默安裝的代碼實(shí)例
這篇文章主要介紹了vbs腳本實(shí)現(xiàn)下載jre包并靜默安裝的代碼實(shí)例,通過本文可以學(xué)到VBS中下載遠(yuǎn)程文件的方法、靜默安裝jre包的方法,需要的朋友可以參考下2014-08-08VBScript教程 第二課在HTML頁面中添加VBscript代碼
VBScript教程 第二課在HTML頁面中添加VBscript代碼...2006-11-11VBS教程:VBscript語句-If...Then...Else 語句
If...Then...Else 語句用于計算條件是否為 True 或 False,并且根據(jù)計算結(jié)果指定要運(yùn)行的語句。通常,條件是使用比較運(yùn)算符對值或變量進(jìn)行比較的表達(dá)式。If...Then...Else 語句可以按照需要進(jìn)行嵌套2006-11-11Windows Script Host之用vbs實(shí)現(xiàn)[瀏覽文件夾]功能
Windows Script Host之用vbs實(shí)現(xiàn)[瀏覽文件夾]功能...2007-07-07