Search code examples
c#sqlwindows-search

Which Windows System Property returns actual path from SQL Windows Search


I am querying Windows Search using SQL

SELECT System.ItemName, System.ItemPathDisplay 
FROM SystemIndex 
WHERE SCOPE = 'file:C:/ProgramData/Microsoft/Windows/Start Menu' 
  AND System.ItemName LIKE '%remote%'

And this is what is returned with the user friendly path

Remote Desktop Connection.lnk;C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Accessories\Remote Desktop Connection.lnk;

The real path should be Accessories NOT Windows Accessories

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\

How do I get the real path from Windows Search?

All System.* properties seem to only return the 'friendly path'


Solution

  • Seems like System.ItemUrl gives me what I need

    Remote Desktop Connection.lnk;file:C:/ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Remote Desktop Connection.lnk;