Ok, here's the script: It iterates shortcuts and spits out their inerds (guts, insides, properties, ingredients, whatever). I didn't invent the concept, nor the methodology, but I did glue the code together since all the examples I found crawled either file/folder shortcuts or URL shortcuts, but not both. Mine does both, so there. Nah nah nah nah...
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strAllUsers = objShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
strThisUser = objShell.ExpandEnvironmentStrings("%USERNAME%")
strUsers = objFSO.GetParentFolderName(strAllUsers)
DesktopPath = strUsers & "\" & strThisUser & "\Desktop"
Set objFolder = objFSO.GetFolder(DesktopPath)
For each objFile in objFolder.Files
strPath = objFile.Path
Select Case Right(Lcase(objFile),4)
Case ".lnk":
Set objShortcut = objShell.CreateShortcut(strPath)
Wscript.Echo "----------------------------------"
Wscript.Echo "Type : file-system shortcut"
WScript.Echo "Full Name : " & objShortcut.FullName
WScript.Echo "Arguments : " & objShortcut.Arguments
WScript.Echo "Working Directory : " & objShortcut.WorkingDirectory
WScript.Echo "Target Path : " & objShortcut.TargetPath
WScript.Echo "Icon Location : " & objShortcut.IconLocation
WScript.Echo "Hotkey : " & objShortcut.Hotkey
WScript.Echo "Window Style : " & objShortcut.WindowStyle
WScript.Echo "Description : " & objShortcut.Description
Case ".url":
Set objShortcut = objShell.CreateShortcut(strPath)
Wscript.Echo "----------------------------------"
Wscript.Echo "Type : internet shortcut"
WScript.Echo "Full Name : " & objShortcut.FullName
WScript.Echo "Target Path : " & objShortcut.TargetPath
End Select
Next
Set objFolder = Nothing
Set objFSO = Nothing
Set objShell = Nothing
No comments:
Post a Comment