如何在vb.net中删除Prefetch文件夹?

时间:2013-12-29 15:30:10

标签: vb.net windows prefetch

如何删除vb.net中的Prefetch文件夹? 我试过了:

kill(“C:\ windows \ prefetch.dll)但它返回错误

“未处理的执行”

2 个答案:

答案 0 :(得分:2)

您正在尝试删除不存在的文件!

清除Prefetch文件可以在VB.NET中完成,如下所示: * Imports System.IO

Dim file As String
For Each file In System.IO.Directory.GetFiles("%systemroot%\prefetch")
System.IO.File.Delete(file)
Next file 

为避免出现任何错误:

Try
 Dim file As String
    For Each file In System.IO.Directory.GetFiles("%systemroot%\prefetch")
    System.IO.File.Delete(file)
    Next file 
Catch ex As Exception
    msgbox("Can not delete Prefetch right now!")
End Try

那么请在管理模式下运行您的应用程序(在win7和8中)

答案 1 :(得分:0)

尝试  Dim文件As String     For System.IO.Directory.GetFiles(“%systemroot%\ prefetch”)中的每个文件     System.IO.File.Delete(文件)     下一个文件 赶上前例外     msgbox(“нанах!”) 结束尝试

相关问题