- A Windows extension which is used to open applications quickly through context menu.
- Visual Studio 2019 (msvc2019)
- Windows 10 21H2 x64
- Use Visual Studio to build x64 OpenWithMenu.dll
- Open cmd as administrator and register
Register.bat
# or
regsvr32 x64\Release\OpenWithMenu.dll
- Setup registry for background's context menu
- Note that CLSID is set in OpenWithMenu.idl and OpenWithMenuImpl.rgs
Register.reg
# [HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenWithMenu]
# @="{33f3c901-789f-4e96-82d5-32b1cb204b40}"
- Open cmd as administrator and unregister
Unregister.bat
# or
regsvr32 /u x64\Release\OpenWithMenu.dll
- Remove background's context menu through registry
Unregister.reg
# [-HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\OpenWithMenu]
- Configurations are saved in registry
HKEY_CURRENT_USER\SOFTWARE\AoiHosizora\OpenWithMenu
. - Note that you need to make sure that regjump.exe can be found in PATH, which is used for registry redirecting. Please visit https://docs.microsoft.com/en-us/sysinternals/downloads/regjump for details.
; 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\""
Name
- Menu title, defaults toOpen folder with
Icon
- Menu icon, supports both exe and ico pathSettingName
- Setting menu title, defaults toSetting
- Note that only those menu items which has non empty
@
andFile
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, requiredFile
- Executable file path, requiredIcon
- Menu icon, supports both exe and ico pathOperation
- Execute operation, defaults toopen
, it can be set torunas
to execute as administrator- Execute with
open
operation usually can detect the current path, butrunas
cannot, so it need to useParameter: %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'
- Execute with
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
- Example for executing ping command:
Directory
- Working directory to execute file, defaults to%V
Style
- Window style to execute file, defaults toSW_NORMAL
, it can be set toSW_HIDE
or0
to hide window