高手帮忙改一下这清理代码

vbgood2008 2008-03-07 04:00:34
高手帮忙改一下这清理代码


@echo off
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清除系统LJ完成!
echo. & pause
上面这个是用.bat格式来运行清理的。 我想做到VB中,应该怎么改呢。做到VB后点一下清理按钮就可以的这种。谢谢了。
...全文
66 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbgood2008 2008-03-08
  • 打赏
  • 举报
回复
能不能给一下代码。谢谢。我要的是直接在VB里运行的。
cbm6666 2008-03-08
  • 打赏
  • 举报
回复
哈哈哈...好面熟的 .bat

舉杯邀明月 2008-03-08
  • 打赏
  • 举报
回复
  调整一下:

Sub DelFile()

Dim sDir$

On Error Resume Next
sDir = Left$(Environ("windir"), 3)
Kill sDir & "*.tmp"
Kill sDir & "*._mp"
Kill sDir & "*.log"
Kill sDir & "*.gid"
Kill sDir & "*.chk"
Kill sDir & "*.old"
Kill sDir & "recycled\*.*"
sDir = Environ("windir")
If (Right(sDir, 1) <> "\") Then sDir = sDir & "\"
Kill sDir & "*.bak"
Kill sDir & "prefetch\*.*"
Kill sDir & "temp\*.*"
sDir = Environ("userprofile")
If (sDir <> "") Then
sDir = sDir & "\"
Kill sDir & "cookies\*.*"
Kill sDir & "recent\*.*"
Kill sDir & "Local Settings\Temporary Internet Files\*.*"
Kill sDir & "Local Settings\Temp\*.*"
End If
MsgBox "清除系统LJ完成!", 64, "信息"

End Sub
舉杯邀明月 2008-03-08
  • 打赏
  • 举报
回复
  试一下这段代码:

Sub DelFile()

Dim sDir$

On Error Resume Next
sDir = Left$(Environ("windir"), 3)
Kill sDir & "*.tmp"
Kill sDir & "*._mp"
Kill sDir & "*.log"
Kill sDir & "*.gid"
Kill sDir & "*.chk"
Kill sDir & "*.old"
Kill sDir & "recycled\*.*"
sDir = Environ("windir")
If (Right(sDir, 1) <> "\") Then sDir = sDir & "\"
Kill sDir & "*.bak"
Kill sDir & "prefetch\*.*"
Kill sDir & "temp\*.*"
sDir = Environ("userprofile")
If (sDir <> "") Then sDir = sDir & "\"
Kill sDir & "cookies\*.*"
Kill sDir & "recent\*.*"
Kill sDir & "Local Settings\Temporary Internet Files\*.*"
Kill sDir & "Local Settings\Temp\*.*"
MsgBox "清除系统LJ完成!", 64, "信息"

End Sub
熊孩子开学喽 2008-03-07
  • 打赏
  • 举报
回复
简单,用SHELL调用这个BAT 就可以了
或者直接用: SHELL CMD DEL...

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧