Search code examples
windows-terminal

How to open script inside Windows Terminal


I have shortcut which under the hood performs something like that:

C:\Windows\System32\cmd.exe /C "powershell D:\ssh.ps1"

it executes ssh.ps1 script which inside opens SSH to ssh user@$ip where $ip comes from variable

but it executes inside cmd, meanwhile I'd want to start it inside Windows Terminal - how can I achieve that?


Solution

  • Assuming you have Window Terminal installed to the default location, it will be located here where USERNAME is your username: C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\wt.exe

    Create your shortcut with the starting location set to something like this: C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\wt.exe powershell.exe -ExecutionPolicy Bypass -File D:\ssh.ps1