1. Home
  2. Boost Productivity with Essential Windows Tips & Tricks
  3. Pin drives to the navigation pane in file explorer windows 10

How to pin drives to the navigation pane in File Explorer on Windows 10

The navigation pane in File Explorer comes with some items pinned to it by default. One of those items is This PC and if you expand it, you can access your Windows’ libraries as well as the drives on your disk. If you need to pin additional items to the navigation pane, you can pin them under ‘Quick Access’. You can pin both drives and folders here. If you’d rather pin drives to the navigation pane so that they’re pinned as their own item instead of a sub-item under This PC or Quick Access, you can. To do that, you need a batch script.

This script was written by Superuser user JosefZ and it can pin the C and D drives to the navigation pane in File Explorer. The script can be modified to pin other drives as well.

Back up Registry key

Before you use this script, you need to back up a registry key. Open the Windows registry, and navigate to the following location.


Right-click the NewStartPanel key, and export it to a safe location. This is a precaution that you should definitely take.

Pin drive to navigation pane

Open Notepad and paste the following in it. Save the file with any name of your choice and with the BAT file extension.

SETLOCAL EnableExtensions
set "_icon=%%SystemRoot%%\system32\imageres.dll,27"
set "_name=D DataDisk"
set "_guid=ffffffff-ffff-ffff-0000-00000000000d"
set "_target=d:\\"

set "_regK=HKCU\Software\Classes\CLSID"
set "_regE=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer"
if NOT "%~1"=="" goto :deleAll
reg add %_regK%\{%_guid%} /ve /t REG_SZ /d "%_name%" /f
reg add %_regK%\{%_guid%}\DefaultIcon /ve /t REG_EXPAND_SZ /d %_icon% /f
reg add %_regK%\{%_guid%} /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0x1 /f
reg add %_regK%\{%_guid%} /v SortOrderIndex /t REG_DWORD /d 0x42 /f
reg add %_regK%\{%_guid%}\InProcServer32 /ve /t REG_EXPAND_SZ /d %%systemroot%%\system32\shell32.dll /f
reg add %_regK%\{%_guid%}\Instance /v CLSID /t REG_SZ /d {0E5AAE11-A475-4c5b-AB00-C66DE400274E} /f
reg add %_regK%\{%_guid%}\Instance\InitPropertyBag /v Attributes /t REG_DWORD /d 0x11 /f
reg add %_regK%\{%_guid%}\Instance\InitPropertyBag /v TargetFolderPath /t REG_EXPAND_SZ /d "%_target%" /f
reg add %_regK%\{%_guid%}\ShellFolder /v FolderValueFlags /t REG_DWORD /d 0x28 /f
reg add %_regK%\{%_guid%}\ShellFolder /v Attributes /t REG_DWORD /d 0xF080004D /f
reg add %_regE%\Desktop\NameSpace\{%_guid%} /ve /t REG_SZ /d "%_name%" /f
reg add %_regE%\HideDesktopIcons\NewStartPanel /v {%_guid%} /t REG_DWORD /d 0x1 /f

goto :eof

reg delete %_regK%\{%_guid%} /f
reg delete %_regE%\Desktop\NameSpace\{%_guid%} /f
reg delete %_regE%\HideDesktopIcons\NewStartPanel /v {%_guid%} /f
goto :endlocal

Once you save the file, right-click it and run it with admin rights. The above script will add the D drive to the navigation pane in File Explorer.

To add the C drive, you need to modify the above script. Specifically, you need to modify lines 3-6 and change them to the following.

set "_icon=%%SystemRoot%%\system32\imageres.dll,31"
set "_name=c SystemDisk"
set "_guid=ffffffff-ffff-ffff-0000-00000000000c"
set "_target=c:\\"

Compare the two sets of lines and you will be able to modify the script so that it can add any drive of your choice.

To remove a drive, open Command Prompt with admin rights and CD to the folder where you’ve saved the scripts. Run the following command but replace ‘name-of-script.bat’ with the name you saved the script with.

name-of-script.bat x

You will have to run this for all drives that you’ve pinned to the navigation pane. If running the command results in problems, restore the registry key that you backed up.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.