Starting Emacs From Global Context Menu

This page lists a few ways to Emacs to the right click menu in the Windows file explorer.

Basic context menu

This will connect to a running Emacs server if one exists.

Save the following text to a file with emacs_explorer.reg. Replace the paths to Emacs binaries to match the location on your system. Double click the file and confirm the security warning to add this to the registry.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER \S oftware \C lasses \* \s hell] [HKEY_CURRENT_USER \S oftware \C lasses \* \s hell \e macsopencurrentframe] @= " &Emacs: Edit in existing window" "icon" = "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe" [HKEY_CURRENT_USER \S oftware \C lasses \* \s hell \e macsopencurrentframe \c ommand] @= "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe -n --alternate-editor= \" C: \\ path \\ to \\ emacs \\ bin \\ runemacs.exe \" \" %1 \" " [HKEY_CURRENT_USER \S oftware \C lasses \* \s hell \e macsopennewframe] @= " &Emacs: Edit in new window" "icon" = "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe" [HKEY_CURRENT_USER \S oftware \C lasses \* \s hell \e macsopennewframe \c ommand] @= "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe -n --alternate-editor= \" C: \\ path \\ to \\ emacs \\ bin \\ runemacs.exe \" -c \" %1 \" "

Emacsclient may stop functioning if there is an old server file left over from previous instance of Emacs which has not shut down properly. To fix this you can clear the server files:

rm "~ \. emacs.d \s erver \* "

Note that HKEY_CLASSES_ROOT is a thing of the past. Please use HKEY_CURRENT_USER\Software\Classes instead.

Ultimate Context Menu "Edit with Emacs," Windows 10

Here is an upgraded version that adds tons and tons of options.

Windows Registry Editor Version 5.00 ;; Be sure to set the correct path to Emacs on your system [HKEY_CURRENT_USER\Software\Classes\*\shell] ;; Open file in existing frame [HKEY_CURRENT_USER\Software\Classes\*\shell\emacsopen1sameframe] @="&Emacs: Edit in existing window" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\*\shell\emacsopen1sameframe\command] @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n \"%1\"" ;; Open file in new frame [HKEY_CURRENT_USER\Software\Classes\*\shell\emacsopen2newframe] @="&Emacs: Edit in new window" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\*\shell\emacsopen2newframe\command] @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -c -n \"%1\"" ;; Dired for desktop background [HKEY_CURRENT_USER\Software\Classes\DesktopBackground\shell\emacsopensameframe] @="&Emacs: Open in dired" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\DesktopBackground\shell\emacsopensameframe\command] @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n \"%v\"" ;; Dired for directory [HKEY_CURRENT_USER\Software\Classes\Directory\shell\emacsopensameframe] @="&Emacs: Open in dired" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\Directory\shell\emacsopensameframe\command] @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n \"%V\"" ;; Dired for directory background [HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\emacsopensameframe] @="&Emacs: Open in dired" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\emacsopensameframe\command] @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n \"%V\"" ;; Dired for drive background [HKEY_CURRENT_USER\Software\Classes\Drive\Background\shell\EmacsOpenDirSameFrame] @="&Emacs: Open in dired" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\Drive\Background\shell\EmacsOpenDirSameFrame\command] ;; as drives haven't space inside their name don't use quoting @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n %L" ;; Dired for drive [HKEY_CURRENT_USER\Software\Classes\Drive\shell\EmacsOpenDirSameFrame] @="&Emacs: Open in dired" "icon"="c:\\path_to\\emacs\\bin\\emacsclientw.exe" [HKEY_CURRENT_USER\Software\Classes\Drive\shell\EmacsOpenDirSameFrame\command] ;; as drives haven't space inside their name don't use quoting @="c:\\path_to\\emacs\\bin\\emacsclientw.exe -n --alternate-editor=\"c:\\path_to\\emacs\\bin\\runemacs.exe\" -n %L"

You should immediately see the options if you right click any file in explorer.

Add Emacs to global Send-To Menu

You can open a file in Emacs via Windows Send To by placing a shortcut to emacsclientw.exe in C:\Documents and Settings\yourName\SendTo . Then, when you right-click on a file and select Send To select emacsclientw. This will open the file in the running version of Emacs; if Emacs isn’t running it will fail, but you can use methods described elsewhere in this Wiki for starting the server automatically. The simplest way I found is to simply add (server-start) to your emacs init file, then configure Windows to automatically start Emacs when you log in and leave Emacs running until you log off.

Press Win+r and in Run dialog type shell:sendto . Copy your newly created shortcut to emacs client to folder that just opened. This will create an entry in send to context menu so you can right click on any document and choose to open it in Emacs.

Older context Menu, for Windows 7 / earlier

Save the following text to a file explorer-edit-with-emacs.reg, fix the paths, then double-click it.

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT \* \s hell \o penwemacs] @= " &Edit with Emacs" "icon" = "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe" [HKEY_CLASSES_ROOT \* \s hell \o penwemacs \c ommand] @= "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe -a \" C: \\ path \\ to \\ emacs \\ bin \\ runemacs.exe \" \" %1 \" " "icon" = "C: \\ path \\ to \\ emacs \\ bin \\ emacsclientw.exe"

Right-click a file in Windows Explorer to see “Edit with Emacs.”

Tested with Windows 7 and Emacs 24.5.1.