node-shell-context-menu
Add a context menu item command on Windows
Install
npm i shell-context-menu
Usage
const shellContextMenu = ; const options = name: 'MyApp' command: 'C:\\MyPath\\MyApp.exe --open'; await shellContextMenu;
Note: It will add the file/folder as argument at the end of the command
registerCommand
Create a context menu item on files
const options = name: 'Explorer' icon: 'C:\\Windows\\explorer.exe' // You can specify a path to an ico file or directly put the path of your app and it will automatically find the icon command: 'C:\\Windows\\explorer.exe' menu: 'Open with Explorer'; await shellContextMenu;
registerDirectoryCommand
Create a context menu item only on folders
const options = name: 'Explorer' icon: 'C:\\MyPath\\icon.ico' // You can specify a path to an ico file or directly put the path of your app and it will automatically find the icon command: 'C:\\Windows\\explorer.exe' menu: 'Open with Explorer'; await shellContextMenu;
registerOpenWithCommand
Create a context menu item OpenWith
on specific filetypes
const options = name: 'Explorer' command: 'C:\\Windows\\explorer.exe'; await shellContextMenu;
removeCommand
Remove a named command
await shellContextMenu;
removeDirectoryCommand
Remove a named directory command
await shellContextMenu;
removeOpenWithCommand
Remove a named OpenWith
command for given filetypes
await shellContextMenu;