Add Optimize Library For to Context Menu in Windows 10

You can add Optimize Library For to the context menu of a Library in File Explorer on Windows 10. That way, you will be able to change the template of a Library from the right-click menu in File Explorer. This will save your time, since you won't need to open the Library's properties any more.


This can be done with a simple Registry tweak. Once you apply it, a special command will be added to the context menu of a Library. There, you will be able to quickly change the content template for the selected Library so it can be optimized for General Items, Documents, Pictures, Music, or Videos. See the following screenshot:

Add Optimize Library For to Context Menu in Windows 10

In our previous article, we saw how to add any Ribbon command to the Context menu in Windows 10. See

How to add any Ribbon command to the right click menu in Windows 10

In short, all the Ribbon commands are stored under the Registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell

You can export the desired command and modify the exported *.Reg in order to add it to the context menu of files, folders, or any other object visible in File Explorer. In our case, we need the command named "Windows.LibraryOptimizeLibraryFor".

Here are the contents of the *.reg file that you need to apply:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Windows.LibraryOptimizeLibraryFor]
"CommandStateSync"=""
"ExplorerCommandHandler"="{9e752621-4573-4308-81c6-9f210db29e85}"
"Icon"="imageres.dll,-5370"
"Position"="Top"


[HKEY_CLASSES_ROOT\Folder\shell\Windows.LibraryOptimizeLibraryFor]
"CommandStateSync"=""
"ExplorerCommandHandler"="{9e752621-4573-4308-81c6-9f210db29e85}"
"Icon"="imageres.dll,-5370"


[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\Windows.LibraryOptimizeLibraryFor]
"CommandStateSync"=""
"ExplorerCommandHandler"="{9e752621-4573-4308-81c6-9f210db29e85}"
"Icon"="imageres.dll,-5370"
"Position"="Top"

Run Notepad. Copy and paste the text above into a new document.

In Notepad, press Ctrl + S or execute the File - Save item in the menu. This will open the Save dialog.

There, type or copy-paste the following name "LibraryOptimize.reg" including quotes. Double quotes are important to ensure that the file will get the "*.reg" extension and not *.reg.txt. You can save the file to any desired location, for example, you can put it in your Desktop folder.

Now, double-click the file LibraryOptimize.reg that you created. Confirm the UAC prompt and click Yes to merge it into the Registry.

Now, right click a Library. The drop down context menu Optimize library for will appear in the context menu:

It will also be available in the Library's background context menu.

To save your time, I made ready-to-use Registry files. You can download them here:

Download Registry Files

The undo file is included, so you can avoid manual Registry editing completely.

Alternatively, you can use Context Menu Tuner. It will allow you to add any Ribbon command to the Library context menu.

Context Menu Tuner Optimize Library For

Select "Windows.LibraryOptimizeLibraryFor" in the list of available commands, select "Library" in the right list and click the "Add" button. You can get the app here:

Download Context Menu Tuner

That's it.

Leave a Reply

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