Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if the shortcut exists or Not?
#2
Solved: 11 Years, 4 Months ago
All you need to do is - write a WMI query that includes the path of the folder you want to check as well as the file extension for shortcuts i.e 'lnk'
e.g this script checks if Quick Test Professional shortcut exist in folder "C:\Test\Shortcuts"
Code:
strComputer = "."
strFolder = "\\Test\\Shortcuts\\"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery ("Select * From Cim_DataFile Where Path = '" & strFolder & "' AND Drive = 'C:' And Extension = 'lnk'")

For Each objItem in colItems
If objItem.FileName = "QuickTest Professional" Then
msgbox "Shortcut Exists"
End If
Next

Reply


Messages In This Thread
RE: Check if the shortcut exists or Not? - by Saket - 06-17-2010, 09:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Report Viewer showing hundreds of WebElement.Exists? themoon 1 2,335 03-09-2016, 02:43 PM
Last Post: vinod123
  How to check whether data exists in excel.. venkatesh9032 1 3,075 03-06-2014, 04:37 PM
Last Post: supputuri
  Object does not exists shwetasharma 4 9,103 03-01-2013, 01:05 PM
Last Post: shwetasharma
  Verifying the value exists and if not, wait up to 5min HeZma 3 4,060 02-25-2012, 12:21 PM
Last Post: rajpes
  How to prove if an object exists? lucster 3 4,935 07-07-2011, 10:24 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 4 Guest(s)