How to find all shortcuts to a file/application?
Solution 1
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.
Solution 2
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.
Related videos on Youtube
Comments
-
jwarzech over 1 year
On Windows is there a way to find all shortcuts for a given file/application? This is something I hope to eventually execute programmatically.
-
Jay Wick over 13 yearsI think the asker meant Shortcut Files not keyboard shortcuts
-
Sun over 9 yearsWould I have to put double quotes around "*.lnk" if needed search inside a folder that had spaces in it?
-
Tim Sparkles over 8 yearsYou need to put double quotes around any path you specify on the command line that has spaces. e.g. You need quotes if you want to change
\*.lnk
to"c:\Program Files\*.lnk"
. If the path with spaces is under your search root but not part of the command line, quotes are unnecessary but still allowed. -
Peter almost 5 yearsIf the to-be-searched filename contains spaces, one has to enclose it by double quotes, of course, and additionally precede it by
/C:
E.g.findstr /ism /C:"note pad.exe" \*.lnk
./C:
enables literal search. Otherwise, the spaces are treated like or-operators. -
Noumenon over 3 yearsNote that it's better to put the name "notepad.exe" as you have done than the full path to notepad.exe. Putting the full path just gave me
FINDSTR: Out of memory
.