Skip to content

A Windows extension that is used to open applications quickly through context menu.

License

Notifications You must be signed in to change notification settings

Aoi-hosizora/OpenWithMenu

Repository files navigation

OpenWithMenu

  • A Windows extension which is used to open applications quickly through context menu.

Environment

  • Visual Studio 2019 (msvc2019)
  • Windows 10 21H2 x64

Build and Register

  1. Use Visual Studio to build x64 OpenWithMenu.dll
  2. Open cmd as administrator and register
Register.bat
# or
regsvr32 x64\Release\OpenWithMenu.dll
  1. Setup registry for background's context menu
Register.reg

# [HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenWithMenu]
# @="{33f3c901-789f-4e96-82d5-32b1cb204b40}"

Unregister

  1. Open cmd as administrator and unregister
Unregister.bat
# or
regsvr32 /u x64\Release\OpenWithMenu.dll
  1. Remove background's context menu through registry
Unregister.reg

# [-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenWithMenu]

Configure

; Use DemoMenu.reg to add demo menu

[HKEY_CURRENT_USER\SOFTWARE\AoiHosizora\OpenWithMenu]
"Name"="Open folder with"
"SettingName"="Setting"

[HKEY_CURRENT_USER\SOFTWARE\AoiHosizora\OpenWithMenu\01 cmd]
@="Command prompt"
"File"="cmd.exe"
"Icon"="cmd.exe"

[HKEY_CURRENT_USER\SOFTWARE\AoiHosizora\OpenWithMenu\02 cmd admin]
@="Command prompt (Admin)"
"File"="cmd.exe"
"Icon"="cmd.exe"
"Operation"="runas"
"Parameter"="/s /k pushd \"%V\""

Root key

  • Name - Menu title, defaults to Open folder with
  • Icon - Menu icon, supports both exe and ico path
  • SettingName - Setting menu title, defaults to Setting

Sub key

  • Note that only those menu items which has non empty @ and File will be shown.
  • Some of theme arguments have the same meaning of ShellExecuteW, see ShellExecuteW function (shellapi.h).
  • key name - Menu ID, required, items will be sorted by this value
  • @ - Menu title, required
  • File - Executable file path, required
  • Icon - Menu icon, supports both exe and ico path
  • Operation - Execute operation, defaults to open, it can be set to runas to execute as administrator
    • Execute with open operation usually can detect the current path, but runas cannot, so it need to use Parameter: %V
    • Command prompt example: File: cmd.exe; Operation: runas; Parameter: /s /k pushd "%V"
    • Powershell example: File: powershell.exe; Operation: runas; Parameter: -noexit -command Set-Location -literalPath '%V'
  • Parameter - Execute parameter, optional, and note that %V means the current path
    • Example for executing ping command: File: cmd.exe; Parameter: /c ping www.google.co.jp
  • Directory - Working directory to execute file, defaults to %V
  • Style - Window style to execute file, defaults to SW_NORMAL, it can be set to SW_HIDE or 0 to hide window

Screenshots

screenshot1 screenshot2

References

About

A Windows extension that is used to open applications quickly through context menu.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published