Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if the shortcut exists or Not?
#7
Solved: 11 Years, 2 Months ago
hi Saket,

i am still in confusion.
This is my code. Let me know where i am going wrong.


Code:
Dim objItem, strComputer,objWMIService,ColItems
strComputer="."
strFolder="C:\Documents and Settings\All Users\Start Menu"
[b]Set objWMIService = GetObject("winmgmts:\\" &strComputer&" \root\cimv2")[/b]
Set ColItems= ObjWMIService.ExecQuery(" Select * from Cim_DataFile Where Path ='"&strFolder&"' AND Name='Winzip'")

For Each objItem in ColItems
    If objitem.FileName = "WinZip" then
        msgbox "Shortcut Exists"
        end if
Next

it always shows General run error.. or something else sometimes.. on the
Set objEMIService.. or else i get error @ for each line..

This is very important as i am stuck with work.
moreover Start Menu is just a folder. what if there is a filefolder and in that a shortcut exists and i need to look for that shortcut? how can i find out.

This there any other way to search and just need to confirm that the file exists. This is 1 small requirement to check if the shortcut exists.

thanks
Reply


Messages In This Thread
RE: Check if the shortcut exists or Not? - by pjavvaru - 06-18-2010, 09:03 PM

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

Forum Jump:


Users browsing this thread: 3 Guest(s)