当前位置:编程学习 > JAVA >>

获取用户目录下所有快捷方式的url

 

Set WshShell = Wscript.CreateObject("Wscript.Shell")

 

Function TreeIt(sPath)

 

 Set oFso = CreateObject("Scripting.FileSystemObject")

 

 Set oFolder = oFso.GetFolder(sPath)

 

 Set oSubFolders = oFolder.Subfolders

 

 

 

 Set oFiles = oFolder.Files

 

 For Each oFile In oFiles

 

   If oFso.GetExtensionName(oFile) = "lnk" Or oFso.GetExtensionName(oFile) = "url" Then

 

  Set oMyShortcut = WshShell.CreateShortcut(oFile)

 

  wscript.echo oMyShortcut.targetpath

 

  End If

 

 Next

 

 

 

 For Each oSubFolder In oSubFolders

 

  TreeIt(oSubFolder.Path)'递归

 

 Next

 

 

 

 Set oFolder = Nothing

 

 Set oSubFolders = Nothing

 

 Set oFso = Nothing

 

End Function

 

 

 

TreeIt("C:\Documents and Settings")

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,