Gaven: I hope this will satisfy you and comply with your restriction of using a non-WSH solutioncode:
Break On
dim $irc
$irC=setoption('Explicit','on')
$iRC=setoption('NoVarsInStrings','on')
$iRC=setoption('WrapAtEOL','on')
dim $objWBEM, $colShortcuts, $objShortcut, $sWQL, $sShortcut
$sShortcut='C:\Documents and Settings\All Users\Start Menu\Programs\Internet Explorer\Internet Explorer.lnk'
$sWQL="Select * from Win32_ShortcutFile where name='"+join(split($sShortcut,'\'),'\\')+"'"
$objWBEM = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colShortcuts=$objWBEM.ExecQuery($sWQL)
? 'Number shortcuts = '+$colShortcuts.count
if $colShortcuts.count
For each $objShortcut in $colShortcuts
? 'Name : ' +$objShortcut.Name
? 'Description : ' +$objShortCut.description
? ''
Next
else
? 'No matching shortcuts found.'
endif
exit 0
However, I would recommed to check for the existance of the file via EXIST first as the WMI call will need to enumerate all shortcuts in order to filter them. The filecheck would speed up things if the shortcut does not exist.
_________________________
There are two types of vessels, submarines and targets.