I'm completely new to scripting.
I would like to write to file:
name, path, target and creation date for all shortcuts on my system.
I composed this script from two scripts from the Script Repository:
'------------------------------shortcuts.vbs--------------------------
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("C:\Scripts\Shortcuts.tsv", ForAppending, True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from _
Win32_ShortcutFile")
For Each objItem in colItems
strCreationDate = WMIDateStringToDate(objItem.CreationDate)
objTextFile.WriteLine _
(objItem.FileName & vbTab & _
objItem.Drive & objItem.Path & vbTab & _
objItem.Target & vbTab & _
strCreationDate)
Next
objTextFile.Close
Wscript.Echo "Finished!"
Function WMIDateStringToDate(dtmDate)
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & _
Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate, _
13, 2))
End Function
'---------------------------------------------------------------------
On my XP Home system, with only one user, this seems to work for all
shortcuts, eg the shortcuts from the *All Users* Desktop and Start Menu,
but not for eg the shortcuts from the *User* Desktop and Start Menu.
Can anyone help, please?
TIA
--
Cheers,
S.F.