Last active
May 18, 2021 19:36
-
-
Save Profesor08/c29f43e2545658374d4537a01c6d097f to your computer and use it in GitHub Desktop.
Open in Windows Terminal
This file contains hidden or 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
<# | |
Hint: Allowing opening tabs in same directory | |
1. Open Windows Terminal settings | |
2. Navigate to Profiles and select one | |
3. Find Starting Directory config | |
4. Activate checkbox "Use parent process directory" | |
5. Repeat 2-4 for all profiles | |
#> | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; | |
exit | |
} | |
$source = "https://raw.githubusercontent.com/microsoft/terminal/main/res/terminal.ico" | |
$destination = "$($env:LOCALAPPDATA)\Microsoft\WindowsApps\terminal.ico" | |
$path = "Registry::HKCR\Directory\background\shell\WindowsTerminal" | |
Invoke-WebRequest -Uri $source -OutFile $destination | |
New-Item -Path $path -Value "Open in Windows Terminal" | |
New-ItemProperty -Path $path -Name "Icon" -PropertyType String -Value $destination | |
New-Item -Path "$($path)/command" -Value "wt.exe -p `"Windows PowerShell`" -d `"%V\.`"" | |
Start-Sleep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment