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
| set WshShell = WScript.CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = WSHShell.SpecialFolders("Desktop")
If oFSO.FolderExists(DesktopPath) Then
For each oFl in oFSO.GetFolder(DesktopPath).Files
if LCase(oFso.GetExtensionName(oFl)) = "lnk" then
vrChmRccrc = replace(oFl.Path,"\","\\")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ShortcutFile WHERE Name = '" & vrChmRccrc & "'",,48)
For Each objItem in colItems
If not oFSO.FileExists(objItem.Target) Then
Variable = MsgBox("Voulez vous supprimer le raccourci: " & oFl.Path, vbYesNo)
If Variable = vbYes Then
Set fsoFile = ofso.getFile(oFl.Path)
fsoFile.delete
End If
End If
Next
End If
Next
End If |