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?
In Windows 10, right-click on a folder you wish to add to Quick Access. From the pop-up menu, click Pin to Quick access, and that folder now appears in the list of those most frequently used. In Windows 11, right-click on a folder and select Show more options > Pin to Quick access.
One way is to open the "Customize Quick Access Toolbar" menu and click or tap "Show above the Ribbon." Alternatively, right-click or press-and-hold any button from the toolbar or the ribbon to "Show the Quick Access Toolbar above the Ribbon."
Add a file to Quick AccessAdding a file to Quick Access is (almost) as easy as dragging and dropping a file to the Favorites section. First, navigate to the file you want to add to Quick Access. Right-click the file, and then click Pin to Quick Access.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With