diff --git a/README.md b/README.md index fc5d7bb..6624699 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ Run the [installer](https://github.com/mintty/wsltty/releases) to install * wsltty package components (see below) in the user’s application folder (where WSL is also installed) * an empty wsltty “home directory” to enable storage of a mintty config file * Start Menu and Desktop shortcuts to start a WSL bash (with some variations, see below) -* optional context menu entries for Windows Explorer to start a WSL bash in the respective folder, installable from the Start Menu subfolder +* optional context menu entries for Windows Explorer to start a WSL bash in the respective folder +* install/uninstall context menu items from Start Menu subfolder * `wsl*.bat` scripts to invoke wsltty manually (with some variations and invocation options, see below) * an uninstall script that can be invoked manually to remove shortcuts and context menu entries diff --git a/add to context menu.lnk b/add to context menu.lnk new file mode 100755 index 0000000..54cd89e Binary files /dev/null and b/add to context menu.lnk differ diff --git a/add to context menu.bat b/config-context-menu.bat similarity index 71% rename from add to context menu.bat rename to config-context-menu.bat index dc6ef8f..b324908 100755 --- a/add to context menu.bat +++ b/config-context-menu.bat @@ -1,10 +1,16 @@ @echo off rem See comments in install.bat about changing the installation directory. - set installdir=%LOCALAPPDATA%\wsltty -rem Explorer context menu + +if "%1"=="/U" goto remove +if "%1"=="/u" goto remove + + +:add +rem add to Explorer context menu + set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell @@ -36,4 +42,18 @@ reg add "%userdirpane%\wsltty" /d "%label% %here%" /f reg add "%userdirpane%\wsltty" /v Icon /d "%icon%" /f reg add "%userdirpane%\wsltty\command" /d "%target0%" /f +goto end + + +:remove +rem remove from Explorer context menu + +rem delete Explorer context menu +set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell +set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell + +reg delete "%userdirname%\wsltty" /f +reg delete "%userdirpane%\wsltty" /f + + :end diff --git a/makewinx.cfg b/makewinx.cfg index 759d716..23543d1 100644 --- a/makewinx.cfg +++ b/makewinx.cfg @@ -47,9 +47,10 @@ FILE11="wsl~.bat" FILE12="wsl-l.bat" FILE13="install.bat" FILE14="uninstall.bat" -FILE15="add to context menu.bat" -FILE16="remove from context menu.bat" -FILE17="wsltty home & help.url" +FILE15="config-context-menu.bat" +FILE16="add to context menu.lnk" +FILE17="remove from context menu.lnk" +FILE18="wsltty home & help.url" [SourceFiles] SourceFiles0=. @@ -73,4 +74,5 @@ SourceFiles0=. %FILE15%= %FILE16%= %FILE17%= +%FILE18%= diff --git a/remove from context menu.bat b/remove from context menu.bat deleted file mode 100755 index e939697..0000000 --- a/remove from context menu.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off - -:explorer context menu - -rem delete Explorer context menu -set userdirname=HKEY_CURRENT_USER\Software\Classes\Directory\shell -set userdirpane=HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell - -reg delete "%userdirname%\wsltty" /f -reg delete "%userdirpane%\wsltty" /f - -:end diff --git a/remove from context menu.lnk b/remove from context menu.lnk new file mode 100755 index 0000000..f638405 Binary files /dev/null and b/remove from context menu.lnk differ diff --git a/uninstall.bat b/uninstall.bat index 96e5bea..64cc3c3 100755 --- a/uninstall.bat +++ b/uninstall.bat @@ -18,7 +18,7 @@ del "%USERPROFILE%\Desktop\WSL Bash ~ in Mintty.lnk" :explorer context menu -call "%installdir%\remove from context menu.bat" +call "%installdir%\config-context-menu.bat" /U :undeploy