-2

How to delete Prefetch folder in vb.net? I tryed :

kill("C:\windows\prefetch.dll) but it return a error

"Unhandled Exeption"

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Alondra
  • 27
  • 5

2 Answers2

2

You are trying to delete a file that does not exist!

Clearing Prefetch files could be done in VB.NET like this: *Imports System.IO

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

To avoid geting any error:

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

Well please run your app in Admin Mode (in win7 and 8)

RockSolid
  • 202
  • 1
  • 3
  • 20
0

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("на нах!") End Try