Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search for shortcut in a particular folder based on comment property

Status
Not open for further replies.

WiccaChic

Technical User
Jan 21, 2004
179
US
Hi all, I think this is a tough one. I need to search for shortcuts in a particular folder, based on the comment in the properties of the shortcut (right click shortcut, select properties). Is that possible? I found a WMI script on MS scripting site that allows me to enumerate every shortcut on a machine, but its way to slow and the shortcuts I am looking for will always be in a particular folder.

Please help!
 
might be talking out of my arse but will this work

For Each aFile In oFolder.Files
If Right(aFile.Name, 4) = ".lnk" 'maybe File.Type better
Set oShortCut = WshShell.CreateShortcut(aFile)???
'do your stuff
'i think the name of method might be misleading!!
Set oShortCut = Nothing
End If
Next
 
Great question, I dont have an answer, but it would be
nice if you could also insert a comment into a link
from script.

hope the smarties are watching....



if it is to be it's up to me
 
Actually you can insert a comment/description via script. I want to search for a particular shortcut based on its comment/description property.

Heres how to set the commen/description property,took forever to work this out but heres how:

Dim objShell, strPath
Dim objShortcut
Set objShell =CreateObject("Wscript.Shell")
strPath = objShell.SpecialFolders("Desktop")
Set objShortcut =objShell.CreateShortcut("MyShortcut.lnk")
With objShortcut
.Targetpath ="%windir%\notepad.exe"
.WindowStyle = 1
.Hotkey = "CTRL+SHIFT+F"
.IconLocation = "notepad.exe, 0"
.Description = "This is Notepad!"
.WorkingDirectory = strDesktop
.Save
End With

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top