Skip to content

Instantly share code, notes, and snippets.

@bitsgalore
Last active March 31, 2025 20:30
Show Gist options
  • Save bitsgalore/7c5da72277557b608c94 to your computer and use it in GitHub Desktop.
Save bitsgalore/7c5da72277557b608c94 to your computer and use it in GitHub Desktop.
Add Windows context menu items

Add Windows context menu to convert Markdown file to MS Word (docx)

Adapted from Adapted from Luke Maciak's Markdown Menus, which is described here (removed PDF option, which I never got to work anyway). Requires PanDoc. Install steps:

  1. Download markdown-to-docx-menu.reg file.
  2. Change path to pandoc.exe to your local Pandoc installation.
  3. Optionally you might want to fine-tune PanDoc's many in- and output options to you own needs as well.
  4. Save the file.
  5. In Windows explorer, right-click on reg file; select Merge and then confirm. All done!

If installation is successful, you can now convert any Markdown file to Word by right-clicking on it, and then click on mk2doc.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\jpylyzer]
[HKEY_CLASSES_ROOT\*\shell\jpylyzer\command]
@="\"C:\\jpylyzer\\jpylyzer.exe\" \"%1\" > \"%1.xml\""
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\mkd2doc]
[HKEY_CLASSES_ROOT\*\shell\mkd2doc\command]
@="\"C:\\Users\\redacted\\AppData\\Local\\Pandoc\\pandoc.exe\" -s -S --ascii -N --toc-depth=2 \"%1\" -o \"%1.docx\""
@bipbip404
Copy link

Hello,
That tried on Windows 10 but ...
After installing Pandoc and creating registry keys, clicking mkd2doc produces the following message:

This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.

@Siardeni
Copy link

Hello,

I made my own reg file with SubCommands and it works very well. Thank you so much !
Just a little problem, for example with a file "myfile.txt" we will have "myfile.txt.docx". I can not find how to play with "%" to remove the original extension. Do you have any suggestions?

Nico

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT*\shell\Pandoc]
"MUIVerb"="&Pandoc"
"SubCommands"="Pandoc.2doc; Pandoc.2txt; Pandoc.2html; "

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2doc]
@="&2doc"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2doc\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.docx""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2txt]
@="&2txt"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2txt\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.txt""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2html]
@="&2html"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2html\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.html""

@tomesparon
Copy link

This was a bit painful to do with regedit, so ended up creating reg.exe commands - This is for docx to .md or .html. Either in the global context or specific for Docx file.

Assumptions

  • Pandoc is installed via Scoop - change the path if it isnt the same as yours
  • Word icon

"Global area"
HKCU\SOFTWARE\Classes*\shell\

 reg add "HKCU\SOFTWARE\Classes\*\shell\Pandoc" /ve /t REG_EXPAND_SZ /d "Pandoc to MD" /f
 reg add "HKCU\SOFTWARE\Classes\*\shell\Pandoc" /v "Icon" /t REG_EXPAND_SZ /d "%ProgramFiles%\Microsoft Office\Root\VFS\Windows\Installer\{90160000-000F-0000-1000-0000000FF1CE}\wordicon.exe" /f
 reg add "HKCU\SOFTWARE\Classes\*\shell\Pandoc\command" /ve /t REG_EXPAND_SZ /d "\"%UserProfile%\scoop\shims\pandoc.exe\" \"%1\" --extract-media=. --from=docx --to=gfm -o \"%1\".md" /f

"Just show for docx files"
HKCU\SOFTWARE\Classes\SystemFileAssociations.docx

reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc" /ve /t REG_EXPAND_SZ /d "Pandoc to MD" /f
reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc" /v "Icon" /t REG_EXPAND_SZ /d "%ProgramFiles%\Microsoft Office\Root\VFS\Windows\Installer\{90160000-000F-0000-1000-0000000FF1CE}\wordicon.exe" /f
reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc\command" /ve /t REG_EXPAND_SZ /d "\"%UserProfile%\scoop\shims\pandoc.exe\" \"%1\" --extract-media=. --from=docx --to=gfm -o \"%1\".md" /f

Variant with HTML

 reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc2" /ve /t REG_EXPAND_SZ /d "Pandoc to HTML" /f
 reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc2" /v "Icon" /t REG_EXPAND_SZ /d "%ProgramFiles%\Microsoft Office\Root\VFS\Windows\Installer\{90160000-000F-0000-1000-0000000FF1CE}\wordicon.exe" /f
 reg add "HKCU\SOFTWARE\Classes\SystemFileAssociations\.docx\shell\Pandoc2\command" /ve /t REG_EXPAND_SZ /d "\"%UserProfile%\scoop\shims\pandoc.exe\" \"%1\" --embed-resources=true --from=docx --to=html -o \"%1\".html" /f

more info gathered here:
https://mrlixm.github.io/blog/windows-explorer-context-menu/#footnote-reference-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment