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
| Option Explicit
Dim Titre,LogFile,WS,AppData,MonTableau,i,DossierSpecial,MesDossierspeciaux
Titre = "Les dossiers spéciaux de Windows"
LogFile = Left(Wscript.ScriptFullName,InstrRev(Wscript.ScriptFullName, ".")) & "txt"
Set WS = CreateObject("WScript.Shell")
MonTableau = Array(_
"AllUsersDesktop",_
"AllUsersStartMenu",_
"AllUsersPrograms",_
"AllUsersStartup",_
"Desktop",_
"Favorites",_
"Fonts",_
"MyDocuments",_
"NetHood",_
"PrintHood",_
"Programs",_
"Recent",_
"SendTo",_
"StartMenu",_
"Startup",_
"Templates")
MesDossierspeciaux = ""
For i = LBound(MonTableau) To UBound(MonTableau)
DossierSpecial = WS.SpecialFolders(MonTableau(i))
MesDossierspeciaux = MesDossierspeciaux & DossierSpecial & vbCrLf & vbCrLf
Msgbox DossierSpecial,64,Titre
Next
MsgBox MesDossierspeciaux,64,Titre
Call WriteLog(MesDossierspeciaux,LogFile)
WS.Run LogFile
Sub WriteLog(strText,LogFile)
Dim fs,ts
Const ForWriting = 2
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(LogFile,ForWriting,True)
ts.WriteLine strText
ts.Close
End Sub |
Partager