Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Windows 7 is there a way to add a location to the Explorer Favorites navigation pane from the command line? I'm working with systems that are frequently re-imaged, and I would like to automate adding a number of favorite folders to explorer.

I imagine these favorites are also stored in the registry. If someone knows where, I could probably automate managing them through the reg command, although this is less than ideal. I've looked at a number of locations related to explorer suggested here, but haven't found them yet.

For information on customizing the favorites section of the navigation pane with Explorer, see http://www.howtogeek.com/howto/10357/add-your-own-folders-to-favorites-in-windows-7/

share|improve this question
up vote 3 down vote accepted

They are stored in each user's profile under %USERPROFILE%\Links.

From the Start search, or Run dialog, or in Explorer (etc.) you can also get there by typing shell:links.

share|improve this answer
    
Wow, didn't think it would be that easy :) Any way to order the links? – John McCarthy Sep 12 '12 at 3:16
    
This answer doesn't mention anything about setting up favourites via the command line. – aaronjbaptiste Sep 14 '13 at 18:10
    
@aaronjbaptiste You create a regular link/shortcut to the location you'd like, and then copy it to that folder. – Ƭᴇcʜιᴇ007 Sep 14 '13 at 18:24
    
@techie007 But what's the command to create a shortcut via the command line? I'm currently using a tool called xxmklink, but AFAIK there is no native way to do this. – aaronjbaptiste Sep 16 '13 at 7:27

AFAIK there is no native method to create a shortcut via the command line (and the Favourites here cannot be a symlink, they must be a shortcut). You can do it using xxmklink:

XXMKLINK.EXE "%userprofile%\Links\Dropbox.lnk" "C:\Dropbox"

Would create a windows Explorer Favourite to C:\Dropbox

share|improve this answer

I believe this answers the question.

I made a function from that post. It might come in handy for someone:

Function New-Shortcut {
Param(
    [Parameter(mandatory=$true)]$TargetPath,
    [Parameter(mandatory=$true)]$Name
)
    $WshShell = New-Object -comObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Links\$Name.lnk")
    $Shortcut.TargetPath = $TargetPath
    $Shortcut.Save()
}
share|improve this answer
    
While this does create a link. The link lacks an icon, name and type. I used the above script to create a shortcut to a directory. When it's clicked on, it presents a "Choose the program you want to use to open the file" dialog. – Bill Westrup Oct 27 '15 at 16:04
    
I tested the function again and cant see any issues here. The icon depends on what you're creating a shortcut to, in this case it's the default directory icon. The name will be whatever you specify.. Considering you get the "Choose the program you want to use to open the file" dialog - are you sure your path is correct? I used this exact command: New-Shortcut -TargetPath "c:\temp\" -Name "TMP" – PowerShellGirl Nov 24 '15 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.