'*****************************************************************************
' FileName: DeleteTemp.VBS
' Author: baomaboy
' Abstract: 删除清理系统临时文件及垃圾信息
'*****************************************************************************
Dim WshSHell,FSO
On Error Resume Next
Set WshSHell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WinVer = WshSHell.Environment("Process")
Set Args = WScript.Arguments
CloseTime = 5
FileName = WScript.ScriptName
FileFullName = WScript.ScriptFullName
FilePath = FSO.GetParentFolderName(FileFullName)
InsPath = FSO.GetSpecialFolder(1)'''0=windows,1=system32,2=user-Temp,
InsFullName = FSO.BuildPath(InsPath ,FileName)
OtherFileName="clearIEcache.exe"
OtherFilePath=FSO.BuildPath(InsPath ,OtherFileName)
TemFileName="DeleteTemp.Bat"
TemFilePath=FSO.BuildPath(InsPath ,TemFileName)
Copyright="玲珑科技"
QQ="QQ:25926183"
Email="Email:25926183@qq.com"
InsTitle="清除系统垃圾文件"
InsAnswer="清除系统垃圾文件"
RegPath1="HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\Shell\DeleteTemp\"
RegValue1="删垃圾信息(&D)"
RegForm1="REG_SZ"
RegPath2="HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\Shell\DeleteTemp\command\"
RegValue2="wscript.exe "&InsFullName
RegForm2="REG_SZ"
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到回收站右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从回收站右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - by baomaboy")
If intAnswer = vbYes Then
WshSHell.RegWrite RegPath1,RegValue1,RegForm1
WshSHell.RegWrite RegPath2,RegValue2,RegForm2
FSO.GetFile(FileFullName).Copy(InsFullName)
If (FSO.FileExists(FSO.BuildPath(FilePath,"clearIEcache.llkj"))) Then
FSO.GetFile(FSO.BuildPath(FilePath,"clearIEcache.llkj")).Copy(OtherFilePath)
else
Call alltovbs
end if
WshSHell.popup _
"添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "安装成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
If intAnswer = vbNo Then
WshSHell.RegDelete RegPath2
WshSHell.RegDelete RegPath1
FSO.DeleteFile InsFullName
FSO.DeleteFile OtherFilePath
WshSHell.popup _
"删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "卸载成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
If intAnswer = vbCancel Then
end if
Else
WshSHell.Run (OtherFilePath),vbHide
Call Install
WSHShell.RegWrite"HKCU\Software\Microsoft\Internet Explorer\TypedURLs\",""'''清除IE地址栏下拉列表
WSHShell.RegDelete"HKCU\Software\Microsoft\Internet Explorer\TypedURLs\"
WSHShell.RegWrite"HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url1",""
WSHShell.RegWrite"HKCU\Software\Microsoft\Internet Explorer\Media\Internet\",""'''清除IE媒体播放器历史记录
WSHShell.RegDelete"HKCU\Software\Microsoft\Internet Explorer\Media\Internet\"
WSHShell.RegWrite"HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\Media\Internet\",""
WSHShell.RegDelete"HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\Media\Internet\"
WSHShell.RegWrite"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMru\",""'''清除开始→运行的历史记录
WSHShell.RegDelete"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMru\"
WSHShell.RegWrite"HKCU\Software\Microsoft\MediaPlayer\Player\RecentFileList\",""'''媒体播放器文件列表
WSHShell.RegDelete"HKCU\Software\Microsoft\MediaPlayer\Player\RecentFileList\"
WSHShell.RegWrite"HKCU\Software\Microsoft\MediaPlayer\Player\RecentURLList\",""'''媒体播放器网络列表
WSHShell.RegDelete"HKCU\Software\Microsoft\MediaPlayer\Player\RecentURLList\"
WshSHell.Run ("%COMSPEC% /C "&TemFilePath),vbHide
End if
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0)
Sub Install()
Set NewFile = FSO.CreateTextFile(TemFilePath, True)
NewFile.WriteLine("@echo off")
NewFile.WriteLine("echo 正在清理系统垃圾文件,请稍等......")
NewFile.WriteLine("del /f /s /q %systemdrive%\*.tmp")
NewFile.WriteLine("del /f /s /q %systemdrive%\*._mp")
NewFile.WriteLine("del /f /s /q %systemdrive%\*.log")
NewFile.WriteLine("del /f /s /q %systemdrive%\*.gid")
NewFile.WriteLine("del /f /s /q %systemdrive%\*.chk")
NewFile.WriteLine("del /f /s /q %systemdrive%\*.old")
NewFile.WriteLine("del /f /s /q %systemdrive%\recycled\*.*")
NewFile.WriteLine("del /f /s /q %windir%\*.bak")
NewFile.WriteLine("del /f /s /q %windir%\prefetch\*.*")
NewFile.WriteLine("del /f /s /q %windir%\temp\*.*")
NewFile.WriteLine("del /f /q %userprofile%\cookies\*.*")
NewFile.WriteLine("del /f /q %userprofile%\recent\*.*")
NewFile.WriteLine("del /f /s /q "&chr(34)&"%userprofile%\Local Settings\Temporary Internet Files\*.*"&chr(34))
NewFile.WriteLine("del /f /s /q "&chr(34)&"%userprofile%\Local Settings\Temp\*.*"&chr(34))
NewFile.WriteLine("del /f /s /q "&chr(34)&"%userprofile%\recent\*.*"&chr(34))
NewFile.WriteLine("echo 清理系统垃圾完成!")
NewFile.WriteLine("rem echo. & pause ")
NewFile.WriteLine("del /f /s /q %0")'''删除自己
NewFile.WriteLine("Exit")
NewFile.Close
End Sub
sub alltovbs()
'''**********************
end function |
|