How to Bulk Edit Shortcuts

Ever need to edit simultaneously the properties of multiple shortcuts?  I did recently; I repartitioned a computer and needed to update my shortcuts to point to the new drive.

I did a web search and didn't find a whole lot on the topic, but luckily did come away with two possibilities:

Freeware Solution: Shortcuts Search and Replace

At http://jacquelin.potier.free.fr/ShortcutsSearchAndReplace/  I found portable (i.e., runs off of a USB thumb drive) freeware that bulk edits shortcuts.  In addition, Shortcuts Search and Replace will locate dead shortcuts.  Given the ease of use (after a quick learning curve) and the added functionality of dealing with invalid shortcuts, I recommend using this option.

Unfortunately, Shortcuts Search and Replace isn't the most intuitive software to use, but don't let that deter you, because it does work.  The help file that comes with SSaR doesn't have much content -- it basically just reiterates the icon explanations given on the software's home page.  So I'll provide a brief set of instructions below.

Search Criteria
You can enter your search parameters in the "Search For" box and that can be as short as just the drive letter.  In my case, I only needed to update drive letters after a repartitioning, so I entered the old drive letter in the "Search For" box and the new one in the "Replace With" box (e.g., D in "Search For" and F in "Replace With").

Indicating Search Paths
You can quickly point the search to just the logged on users start menu by toggling the single person icon (6th from left) or the All Users start menu by toggling the double person icon (7th from left).  You also can quickly indicate desktop by toggling the desktop icon (8th from left).  Otherwise, use the button with the ellipsis (three dots) just to the right of the path box to browse to and select the path to select; I used this method to search and replace shortcuts in the Quick Launch bar.

Make sure to toggle Windows Explorer icon (the 5th icon from the left) if you need the search to include subfolders.

Searching and/or Replacing
Finally, with search criteria (and perhaps replace criteria) and paths set, look at the set of icons at top; the first one just executes a search; the second one -- the one with the faded-color binoculars icon -- executes search and replace. If you are doing search and replace and your search is successful, then a list of shortcuts comes up.  There will be a checkbox next to each shortcut.  You have to check the box next to the shortcut for it to be replaced; unfortunately there are no "check all" or "uncheck all" options so if there all a lot of shortcuts, it'll take time to check them all.  Once done checking those shortcuts you want to update, you must click the "Replace" button that appears at the lower right under the search results.


Once you hit the button, the replace executes.  You can check if its success by repeating your search, which this time should come up empty.

Programmatic Solution: VBScript

At http://www.experts-exchange.com/Digital_Living/Hardware/Cameras_Camcorders/Q_23084634.html I found the following script, which the Original Poster said worked correctly:

strComputer = "."
strDrive = Chr(39) & "S:" & Chr(39)
strPath = Chr(39) & "\\my documents\\my pictures\\slideshow copy of uk shortcuts\\" & Chr(39)
strExt = Chr(39) & "lnk" & Chr(39)
strOldTarget = "S:\my documents\My pictures\2007 UK Trip"
strNewTarget = "S:\my documents\My pictures\2007\UK Trip"
 
strQuery = "Drive = " & strDrive & " AND Path = " & strPath & " AND Extension = " & strExt
Set objWMIService = GetObject _
    ("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * From CIM_DataFile WHERE " & strQuery)
 '& " AND Path = " & strPath & " AND Extension = 'lnk'")
For Each objFile in colFiles
 Set objShell = CreateObject("WScript.Shell")
 Set objShellLink = objShell.CreateShortcut(objFile.Name)
 strTarget = Replace(objShellLink.TargetPath, strOldTarget, strNewTarget)
 objShellLink.TargetPath = strTarget
 objShellLink.Save()
Next 

The code is pretty self-explanatory and would be easy to tweak to serve your needs.

3 comments:

  1. Hi

    In article How to Bulk Edit Shortcuts By Chris January 10, 2010;
    the freeware "Shortcuts Search and Replace" is mentioned with the following
    unfortunately there are no "check all" or "uncheck all" options so if there all a lot of shortcuts, it'll take time to check them all

    This is just to tell you I read your article and published the version 1.2.2 on Wed, 20 Oct 2010 to reply to this need
    (available at http://jacquelin.potier.free.fr/ShortcutsSearchAndReplace/)

    Best Regards
    Jacquelin

    ReplyDelete
  2. Hi, I came across the shareware application "Shortcut Doctor" by Funduc Software that offers the same functionality.
    Best regards,
    Simon

    ReplyDelete
  3. I couldn't figure out how ShortcutsSearchAndReplace worked for the life of me. The toolbar icons are really useless without any immediately visible text. You have to hover each single icon to see what it does and then try to infer what it means and remember it. I stumbled into this website and finally figured out how to use it. So thanks to you and thanks to the software author for trying

    ReplyDelete

Note: Only a member of this blog may post a comment.