Search code examples
c#windows-7windows-shellfavorites

How do I programmatically add a folder to the user's Favorites (in Windows Explorer)?


I am looking for a way to programmatically add a folder to the Favorites in Windows Explorer. Its Windows Explorer specific and based around this project: http://www.codeproject.com/Tips/132804/Open-folders-using-a-Run-Command

So far I've tried Process Monitor and searching the registry, but I can't seem to find my Windows Explorer Favourites in regedit.


Solution

  • Instead of reading the registry, you can do the following:

    string favoritesFolder = 
        Environment.GetFolderPath(Environment.SpecialFolder.Favorites);