The following code displays all shortcuts on a PC along with the path
and target. How can I modify this to find a specific shortcut? I
can't seem to find any documentation on this.



Set colItems = objWMIService.ExecQuery("Select * from
Win32_ShortcutFile",,48)
For Each objItem in colItems

Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Target: " & objItem.Target
Next

Re: Find Particular Shortcut by tomthumbkop

tomthumbkop
Tue Apr 27 13:59:31 CDT 2004


Did you try:


Code
-------------------

Set colItems = objWMIService.ExecQuery("Select * from
Win32_ShortcutFile WHERE Name='blah.lnk'",,48)

-------------------


Cameltoer wrote:
> *The following code displays all shortcuts on a PC along with th
> path
> and target. How can I modify this to find a specific shortcut? I
> can't seem to find any documentation on this.
>
>
>
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_ShortcutFile",,48)
> For Each objItem in colItems
>
> Wscript.Echo "Name: " & objItem.Name
> Wscript.Echo "Target: " & objItem.Target
> Next


-
tomthumbko
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------


Re: Find Particular Shortcut by cameltoer

cameltoer
Wed Apr 28 10:58:27 CDT 2004

Yes, it simply runs without returning anything.





tomthumbkop <tomthumbkop.15dz81@mail.codecomments.com> wrote in message news:<tomthumbkop.15dz81@mail.codecomments.com>...
> Did you try:
>
>
> Code:
> --------------------
>
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_ShortcutFile WHERE Name='blah.lnk'",,48)
>
> --------------------
>
>
> Cameltoer wrote:
> > *The following code displays all shortcuts on a PC along with the
> > path
> > and target. How can I modify this to find a specific shortcut? I
> > can't seem to find any documentation on this.
> >
> >
> >
> > Set colItems = objWMIService.ExecQuery("Select * from
> > Win32_ShortcutFile",,48)
> > For Each objItem in colItems
> >
> > Wscript.Echo "Name: " & objItem.Name
> > Wscript.Echo "Target: " & objItem.Target
> > Next *

Re: Find Particular Shortcut by Michael

Michael
Wed Apr 28 22:06:53 CDT 2004

> Yes, it simply runs without returning anything.
---snip---
>> Did you try:
>>
>>
>> Code:
>> --------------------
>>
>> Set colItems = objWMIService.ExecQuery("Select * from
>> Win32_ShortcutFile WHERE Name='blah.lnk'",,48)
>>
>> --------------------

Given: c:\folder\folder\blah.lnk

The Win32_ShortcutFile.Name property is the file's fully qualified path.

e.g. c:\folder\folder\blah.lnk

The FileName property is just the file name without extenstion

e.g. blah


The FileExtension property is just the extenstion

e.g. lnk

So try...

Set colItems = objWMIService.ExecQuery(_
"Select * from Win32_ShortcutFile" _
& " WHERE FileName='blah'",,48)

--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US