1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Option Explicit
On Error Resume Next
Dim AFile, TheFiles, IETemp, IEcontentie5, myTemp, myCookies, myRecent, Afolder, TheFolder
Dim FSO
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys
For Each objSubkey In arrSubkeys
strValueName = "ProfileImagePath"
strSubPath = strKeyPath & "\" & objSubkey
objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue
IETemp = strValue & "\Local Settings\Temporary Internet Files"
IEcontentie5 = strValue & "\Local Settings\Temporary Internet Files\Content.ie5"
myTemp = strValue & "\Local Settings\Temp"
myCookies = strValue & "\Cookies"
myRecent = strValue & "\Recent"
NettoyageDossier (IETemp)
NettoyageDossier (IEContentie5)
NettoyageDossier (myTemp)
NettoyageDossier (myCookies)
NettoyageDossier (myRecent)
'Pour tester les variable
WScript.Echo IETemp
' &VbCrLf& IEContentie5 &VbCrLf& myTemp &VbCrLf& myCookies &VbCrLf& myRecent
Next
msgbox "Maintenant on peut souffler !"
Sub NettoyageDossier (RepConcerne)
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
set Afolder=FSO.GetFolder (RepConcerne)
Set TheFiles = AFolder.Files
Set TheFolder = Afolder.SubFolders
For Each AFile In TheFiles
On Error Resume Next
AFile.Delete
On Error Goto 0
Next
For Each AFile In TheFolder
On Error Resume Next
AFile.Delete
On Error Goto 0
Next
End Sub |
Partager