Skip to main content

Context menu

Add a right-click "Open with…" entry in Explorer for files, directories, or directory backgrounds.

Applies to: MSI and MSIX.

contextMenu for MSI requires digitalSignature. Under the hood MPDEV deploys a tiny sparse MSIX that gives your Win32 app the identity Windows needs for context menu extensions, and that sparse package must be signed. See Digital Signature for signing setup.


contextMenu – right-click integration​

Properties​

PropertyTypeRequiredDefaultDescription
fileTypeenumyes–One of * (any file), Directory, Directory\\Background. NEW in 2.2.0 – previously a free string.
executablestringyes–Exe to invoke when the menu item is clicked.
namestringyes–Display text in the right-click menu.
iconstringno–Existing path on the target system (post-install). Use $.installDir\… to reference the installed exe. Supported: .ico, .exe, .dll.
argumentsstringno"%1"Arguments passed to the exe. Use %1 to receive the selected path.
conditionstringno–Regex evaluated against the selected file/folder path to decide visibility.
note

fileType values:

  • * – any file.
  • Directory – right-click on a folder.
  • Directory\Background – right-click on the empty area inside a folder.

Examples​

"Open with My Application" on any file​

"contextMenu": [
{
"fileType": "*",
"executable": "$.installDir\\MyApp.exe",
"name": "Open with My Application",
"icon": "$.installDir\\MyApp.exe",
"arguments": "\"%1\""
}
]

Right-click a folder to open it in My Application​

{
"fileType": "Directory",
"executable": "$.installDir\\MyApp.exe",
"name": "Open folder in My Application",
"arguments": "--folder \"%1\""
}

Right-click in the empty area of Explorer​

{
"fileType": "Directory\\Background",
"executable": "$.installDir\\MyApp.exe",
"name": "New My Company Note here",
"arguments": "--new \"%V\""
}

%V (capital V) is the Windows shell token for the current directory when invoked on a directory background.

Conditionally show only for .txt files​

{
"fileType": "*",
"executable": "$.installDir\\MyApp.exe",
"name": "Convert TXT to My Company Note",
"arguments": "--convert \"%1\"",
"condition": "(?i)\\.txt$"
}

The condition is a regex matched against the selected item's path.


MSI vs MSIX behavior​

AspectMSIMSIX
contextMenuRequires digitalSignature. Implemented as a sparse MSIX overlay that gives your Win32 app identity.Declared in the MSIX manifest extensions. Always works.
condition regexHonored at shell extension load time.Honored.

Validation rules​

ValidatorCatch
requiredfileType, executable, name are mandatory.
valid pathexecutable and icon must be syntactically valid paths.
valid valuecontextMenu.fileType must be one of *, Directory, Directory\\Background.
digital signature required - context menucontextMenu for MSI requires a digitalSignature block.