本帖最后由 pcl_test 于 2015-9-26 22:55 编辑
vbs- Set Shell = CreateObject("WScript.Shell")
- Set fso = CreateObject("Scripting.FileSystemObject")
- Desk = Shell.SpecialFolders("DeskTop")
- Set Folder = fso.GetFolder(Desk)
- Set Files = Folder.Files
- For Each File In Files
- If Lcase(Right(File,4))=".lnk" Then Dellnk(File)
- Next
-
- Function Dellnk(objlnk)
- n=0
- Set Link = Shell.CreateShortcut(objlnk)
- GetTarget = Link.Targetpath
- If not fso.FileExists(GetTarget) Then n=n+1
- If not fso.FolderExists(GetTarget) Then n=n+1
- If n=2 Then fso.DeleteFile objlnk
- End Function
复制代码
|