Created
June 17, 2020 08:22
-
-
Save kmantel/9cd6bf9f0fb25694a5b08119817281b7 to your computer and use it in GitHub Desktop.
Creates a context menu shortcut for launching Windows Terminal in the current directory from explorer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo You must add "startingDirectory": "." to your Windows Terminal profile ^ | |
settings or this will not work. | |
echo( | |
set winterm_path="\"%LocalAppData%\Microsoft\WindowsApps\wt.exe\"" | |
reg add HKCR\Directory\Background\shell\winterm\command | |
reg add HKCR\Directory\Background\shell\winterm\command /ve /t REG_EXPAND_SZ /d %winterm_path% | |
reg add HKCR\Directory\Background\shell\winterm\ /ve /t REG_EXPAND_SZ /d "Open Windows Terminal here" | |
REM if the icon search doesn't work you will need to take ownership and | |
REM change permissions of the WindowsApps folder: | |
REM icacls "%ProgramFiles%\WindowsApps" /save WindowsApps.acl | |
REM icacls "%ProgramFiles%" /restore WindowsApps.acl | |
for /f "delims=" %%a in ('where /r "%ProgramFiles%\WindowsApps" "WindowsTerminal.exe"') do @set icon_path=%%a | |
if "%icon_path%" == "" ( | |
echo Couldn't find the Windows Terminal icon. You will need to gain read ^ | |
permissions for %ProgramFiles%\WindowsApps if you don't want the default icon. ^ | |
Use icacls /save and /restore. | |
echo( | |
pause | |
exit | |
) | |
reg add HKCR\Directory\Background\shell\winterm\ /v Icon /t REG_EXPAND_SZ /d "%icon_path%" | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment