怎样用VB删除IE临时文件 怎样用VB删除IE临时文件? 在DOS下无法用Dir无法列出其中的文件,因此无法使用Kill来删除这些文件。...请问要怎样才能删除IE临时文件。 可否举例,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是如何删除 c:\Temporary Internet Files\ 下的文件? Option Explicit Private gstrSEP_DIR As String Sub FPDeleteTree(inPath As String) '定义临时变量 Dim tmpPath As String, curPath As String Dim tmpFileName As String '保存指定路径 curPath = inPath: AddDirSep curPath '不理目录下文件属性,统统删除。 tmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem) Do While Not tmpFileName = "" SetAttr curPath & tmpFileName, vbNormal Kill curPath & tmpFileName tmpFileName = Dir Loop '循环删除子目录及其内容 tmpPath = Dir(curPath, vbDirectory) Do While tmpPath = "." Or tmpPath = ".." tmpPath = Dir Loop Do While Not tmpPath = "" curPath = curPath & tmpPath AddDirSep curPath tmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem) Do While Not tmpFileName = "" SetAttr curPath & tmpFileName, vbNormal Kill curPath & tmpFileName tmpFileName = Dir Loop tmpPath = Dir(curPath, vbDirectory) Do While tmpPath = "." Or tmpPath = ".." tmpPath = Dir Loop If tmpPath = "" Then RmDir curPath curPath = inPath AddDirSep curPath tmpPath = Dir(curPath, vbDirectory) Do While tmpPath = "." Or tmpPath = ".." tmpPath = Dir Loop End If Loop AddDirSep inPath RmDir inPath End Sub '****************************************************************************** ' 子程序: AddDirSep '****************************************************************************** Sub AddDirSep(strPathName As String) If Right$(RTrim$(strPathName), Len(gstrSEP_DIR)) <> gstrSEP_DIR Then strPathName = RTrim$(strPathName) & gstrSEP_DIR End If End Sub Private Sub Command1_Click() gstrSEP_DIR = "\" FPDeleteTree ("e:\www") End Sub 網上找的,不知道對你是否有用? 我的目的是为了删除Temporary Internet Files目录下的指定文件,因为全删除后网页的刷新太慢 先getspecialfolder,再kill "*.*" 用WithEvents 定义对象出错,急呀,求大家帮帮 关于VB程序运行的问题,紧急求助啊!! 懸賞:探討程序自動運行的有哪些方法 頂者有分 国庆期间仍在努力工作的同志們===大家一起來灌水啊~~ 关于VFoutBar控件的用法。 VB如何访问视图 关于 VB DirectX 问题? 新手求救!明天要交!在线等,同一个窗体里面,我想在第二函数用回第一条函数获得的值,怎么办? 如何用MSO中的COMMANDBAR 大家平时工作中都用什么工具? 请教:关于VB调用Crystal报表的问题 做个小调查: 大家的吨位都是什么数值(范围).......??
Private gstrSEP_DIR As String
Sub FPDeleteTree(inPath As String)
'定义临时变量
Dim tmpPath As String, curPath As String
Dim tmpFileName As String
'保存指定路径
curPath = inPath: AddDirSep curPath
'不理目录下文件属性,统统删除。
tmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem)
Do While Not tmpFileName = ""
SetAttr curPath & tmpFileName, vbNormal
Kill curPath & tmpFileName
tmpFileName = Dir
Loop
'循环删除子目录及其内容
tmpPath = Dir(curPath, vbDirectory)
Do While tmpPath = "." Or tmpPath = ".."
tmpPath = Dir
Loop
Do While Not tmpPath = ""
curPath = curPath & tmpPath
AddDirSep curPath
tmpFileName = Dir(curPath, vbNormal + vbHidden + vbSystem)
Do While Not tmpFileName = ""
SetAttr curPath & tmpFileName, vbNormal
Kill curPath & tmpFileName
tmpFileName = Dir
Loop
tmpPath = Dir(curPath, vbDirectory)
Do While tmpPath = "." Or tmpPath = ".."
tmpPath = Dir
Loop
If tmpPath = "" Then
RmDir curPath
curPath = inPath
AddDirSep curPath
tmpPath = Dir(curPath, vbDirectory)
Do While tmpPath = "." Or tmpPath = ".."
tmpPath = Dir
Loop
End If
Loop
AddDirSep inPath
RmDir inPath
End Sub
'******************************************************************************
' 子程序: AddDirSep
'******************************************************************************
Sub AddDirSep(strPathName As String)
If Right$(RTrim$(strPathName), Len(gstrSEP_DIR)) <> gstrSEP_DIR Then
strPathName = RTrim$(strPathName) & gstrSEP_DIR
End If
End Sub
Private Sub Command1_Click()
gstrSEP_DIR = "\"
FPDeleteTree ("e:\www")
End Sub
網上找的,不知道對你是否有用?