Is it possible programmatically add folders to the Windows 10 Quick Access panel in the explorer window?

Apparently Microsoft has (sort of) replaced the "Favorites" Windows explorer item with the Quick Access item. But I haven't been able to find a way to programmatically add folders to it (neither on Google not MSDN). Is there no way to do this yet?


Solution 1:

There is a simple way to do it in powershell (at least) :

$o = new-object -com shell.application
$o.Namespace('c:\My Folder').Self.InvokeVerb("pintohome")

Hope it helps.

Solution 2:

Yohan Ney's answer for pinning an item is correct. To unpin an item you can do this:

$QuickAccess = New-Object -ComObject shell.application 
($QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() | where {$_.Path -eq "C:\Temp"}).InvokeVerb("unpinfromhome")

Here's a script I wrote to make pin/unpin a little easier:

https://gallery.technet.microsoft.com/Set-QuickAccess-117e9a89

Solution 3:

Maybe it will help someone until MS releases an API. I ran procmon and it seems that these registry keys are involved

Pin to Quick access:

HKEY_CLASSES_ROOT\Folder\shell\pintohome

When unpin:

HKEY_CLASSES_ROOT\PinnedFrequentPlace\shell\unpinfromhome\command

Also this resource is used when pinning: (EDIT1: can't find it any longer..)

AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations\{SOME_SORT_OF_GUID}.automaticDestinations-ms

You can try opening it with 7-zip, there are several files in there which fit the destination

EDIT2: I found running this in the 'Run' opens up Quick access:

shell:::{679F85CB-0220-4080-B29B-5540CC05AAB6}

Solution 4:

I got an answer here:

Windows 10 - Programmatically use Quick Access

Apparently, it's not possible yet, but a proposition for such an API has been made.

Solution 5:

I like Johan's answer but I added a little bit to make not remove some of the items that were already in there. I had a ton pinned in there by accident I must have selected pin folder or something to quick access.

$QuickAccess = New-Object -ComObject shell.application 
$okItems = @("Desktop","Downloads","Documents","Pictures","iCloud Photos","iCloud Drive","PhpstormProjects","Wallpapers 5","Videos", "Schedules for testing")
($QuickAccess.Namespace("shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}").Items() | where {$_.name -notin $okItems}).InvokeVerb("unpinfromhome");