高手帮忙改一下这清理代码
@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后点一下清理按钮就可以的这种。谢谢了。

解决方案 »

  1.   

    简单,用SHELL调用这个BAT 就可以了
    或者直接用: SHELL CMD DEL...
      

  2.   

      试一下这段代码: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
      

  3.   

      调整一下: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