Skip to content

Menu Item Type

ExplorerItemType

Bases: StrEnum

Possible types of explorer items.

Explorer items are types of clickable items, such as files, folders, drives, shortcuts, desktop background, etc. Also known as shell items.

Question

The difference between Directory and Folder is that Folders include special folders such as "This PC" folder. See Directory vs. Folder, CLSID List

Tip

For more advanced control of conditions see Condition.

ALL_FILES

ALL_FILES = '*'

Affect right-clicking any file.

SPECIFIC_FILE_TYPE

SPECIFIC_FILE_TYPE = 'SystemFileAssociations\\{file_type}'

Affect right-clicking a specific file extension or extension class.

Example
ContextMenuLocation(
    MenuAccessScope.ALL_USERS,
    MenuItemType.SPECIFIC_FILE_TYPE.format(file_type=".mp4"),
).construct_registry_path()
# HKEY_LOCAL_MACHINE\Software\Classes\SystemFileAssociations\.mp4\shell

ContextMenuLocation(
    MenuAccessScope.ALL_USERS,
    MenuItemType.SPECIFIC_FILE_TYPE.format(file_type="image"),
).construct_registry_path()
# HKEY_LOCAL_MACHINE\Software\Classes\SystemFileAssociations\image\shell

EXTENDED_FOLDERS

EXTENDED_FOLDERS = 'Folder'

Affect right-clicking all folders, including special shell folders (e.g., Libraries, This PC, Control Panel).

DIRECTORY_BACKGROUND

DIRECTORY_BACKGROUND = 'Directory\\Background'

Affect right-clicking the background in explorer.

DRIVES

DRIVES = 'Drive'

Affect right-clicking a drive.

DIRECTORIES

DIRECTORIES = 'Directory'

Affect right-clicking directories, not including special shell folders such as This PC/Libraries.

NETWORK_FOLDERS

NETWORK_FOLDERS = 'Network'

Affect right-clicking network folders.

DESKTOP_BACKGROUND

DESKTOP_BACKGROUND = 'DesktopBackground'

Affect right-clicking the desktop background.

SHORTCUTS

SHORTCUTS = 'lnkfile'

Affect right-clicking a shortcut (.lnk).

Warning

If both SHORTCUTS and ALL_FILES (or SPECIFIC_FILE_TYPE with .lnk) handler exists, this may cause unexpected behavior. See CommandPlaceholders documentation for more details.