Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pin a folder to Navigation Pane in Windows Explorer

I want to create a folder and pin it to the Navigation Pane in Windows Explorer, but I am unsure how to do this.

I'd like to create something similar to a DropBox or OneDrive folder.

Something like this -

Something like this

I've looked at the Manipulating the Windows 7 Explorer navigation pane question but I don't think its what I want. The application will run on machines with Windows 7 to Windows 10. Is it possible to do this on all these OS?

Any help would be greatly appreciated.

like image 285
Belothian Avatar asked May 21 '14 08:05

Belothian


1 Answers

This is partially documented in this document : Integrate a Cloud Storage Provider although the title is misleading; it works for regular folders. Also, it works fine on Windows 7, Windows 8.x, and 10.

So, here is the content of a .BAT file (using the standard reg.exe tool, but you can easily replace this by C# code) that can create a folder like OneDrive. First you must create a Guid by any means, replace the "MyExt" name by your folder's display name, the "c:\temp\myext" path by any physical path, and then run this .bat file.

reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000} /ve /t REG_SZ /d "MyExt" /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\DefaultIcon /ve /t REG_EXPAND_SZ /d %%SystemRoot%%\system32\imageres.dll,-111 /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000} /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0x1 /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000} /v SortOrderIndex /t REG_DWORD /d 0x42 /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\InProcServer32 /ve /t REG_EXPAND_SZ /d %%systemroot%%\system32\shell32.dll /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\Instance /v CLSID /t REG_SZ /d {0E5AAE11-A475-4c5b-AB00-C66DE400274E} /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\Instance\InitPropertyBag /v Attributes /t REG_DWORD /d 0x11 /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\Instance\InitPropertyBag /v TargetFolderPath /t REG_EXPAND_SZ /d "c:\temp\myext" /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\ShellFolder /v FolderValueFlags /t REG_DWORD /d 0x28 /f
reg add HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}\ShellFolder /v Attributes /t REG_DWORD /d 0xF080004D /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{YOURGUID-GOES-HERE-0000-000000000000} /ve /t REG_SZ /d "MyExt" /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {YOURGUID-GOES-HERE-0000-000000000000} /t REG_DWORD /d 0x1 /f

Note this will register the folder for the current user (so you don't need special rights in the registry), but if you want to register it for the whole machine, you'll have to replace HKCU by HKLM (and you'll need proper rights then).

Also note I've chosen a default icon in imageres.dll but you can use anything else of course.

This is how it looks like on Windows 10: enter image description here


To remove the folder from the pane, create another .BAT file with the following content:

reg delete HKCU\Software\Classes\CLSID\{YOURGUID-GOES-HERE-0000-000000000000}
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{YOURGUID-GOES-HERE-0000-000000000000}
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel
like image 50
Simon Mourier Avatar answered Oct 04 '22 21:10

Simon Mourier