On Windows 10, there is a new and awesome tool available for any PowerShell user: Windows Terminal. It lets you use multiple PowerShell and other console tabs side-by-side, and you can mix Windows PowerShell, PowerShell 7, and Azure CloudShell consoles. You can install Windows Terminal from the Microsoft Store.

As with any app, Windows Terminal is managed by Windows and can be updated at any time. It also is always installed „per user“.

If you plan to run lengthy tasks or business-critical scripts inside one of its consoles, you may want to turn the app into a portable app that only you control. This way, muliple users can use Windows App, too.

The below script requires that you have installed the Windows Terminal app and that you run the code with Administrator privileges:

#requires -RunAsAdmin

# location to store portable app
$destination = 'c:\windowsterminal'


# search for installed apps...
Get-ChildItem "$env:programfiles\WindowsApps\" | 
# pick Windows Terminal...
Where-Object name -like *windowsterminal* | 
# find the executable...
Get-ChildItem -Filter wt.exe | 
# identify executable versions...
Select-Object -ExpandProperty VersionInfo | 
# sort versions...
Sort-Object -Property ProductVersion -Descending | 
# pick the latest...
Select-Object -First 1 -ExpandProperty filename | 
# get parent folder...
Split-Path | 
# dump folder content...
Get-ChildItem | 
# copy to destination folder
Copy-Item -Destination $destination -Force

# open folder
explorer $destination

# run portable app
Start-Process -FilePath "$destination\wt.exe" 




Twitter This Tip! ReTweet this Tip!

Anonymous