On Windows is there a way to find all shortcuts for a given file/application? This is something I hope to eventually execute programmatically.
findstr /ism notepad.exe \*.lnk
findstr.exe comes bundled with Windows since XP if not earlier. It lives in c:\windows\system32.
- /i specifies case-insensitive search
- /s specifies recursive search descending into subfolders
- /m specifies 'display only the file name when matches are found'. Without this option, findstr will spit out a bunch of ascii-translated binary garbage
notepad.exe is the target of the shortcut, replace with the actual executable you're interested in.
\*.lnk gets implicitly split into two parts: "\" specifying the root of the search, and "*.lnk" specifying the files to search.
You can search for *.lnk files that contain the path or executable name.
For example: look for files *.lnk that contain notepad.exe
I tried using Windows 7 search
notepad.exe kind:*.lnk and couldn't get it to work all the time. I think it may have problems with the non-indexed directories. I tried some setting changes and if I was close I got it to work, but if I went to the root of a drive I didn't get it to work.
I did have luck using UltraEdit, but I'm sure there are other (free) text editors out there that will search directories/subdirectories.
Of course depending on how unique of a search you make and the program/folder name, you could get false positives. But this should find all the shortcuts to the target you were looking for, that you have permissions to see and read. (i.e. A user may have one on his/her desktop and you not have permission to see that user's desktop.)
Hope this helps.
EDIT: I just found TextCrawler, I hadn't tried it, but it may be able to do the search I described.
Sorry I can't ask you what programming env. you're using. However, I do know about this Windows Script Host COM reference.
Additionally, I don't think I ever say it mentioned in the documentation, but if you want to "read" a shortcut, you use the same WshShell.CreateShortcut command to "open" the shortcut file, then just call variable.TargetPath to get the value.
I've seen some references also on how to do this in PowerShell, although it looked even more complicated than these examples.
Keyboard shortcuts for Microsoft programs: http://www.microsoft.com/enable/products/keyboard.aspx
This URL covers:
- All the Windows operating systems back to Windows Server 2003.
- Microsoft Office Suite (and all the programs within) 2003, 2007, & 2010
- Internet Explorer 6, 7, 8
- Windows Media Center, Windows Media Player 11 & 12.
And if you want to find them for a specific program, just google the name of the program along with the release number and keyboard shortcuts.
Mozilla Firefox 3.6 keyboard shortcuts
Open the start menu/button, and enter:
type: *.lnk in the search/run field at the bottom. Click "see more results" in blue, now just above that.
A new explorer window will open. Change the file-view to "Detailed".
Right-click the "title"bars for each category, and add "
Link target" to the fields shown (you will likely need to click "more" and find it in the alphabetical list)
Now click on the
Link target "title"bar to sort by Link target, and find all your windows-shortcut-files that point to your target file.
This should show all variations of command-line flags, since you're sorting alphabetically by target path.