How can I change the default Powershell host to new Windows Terminal?

0

I'm using the new Windows Terminal, which allows to run any of the existing Windows shells, like Powershell 5, 6, 7/Core.

Unfortunately that only works, if I start the new terminal first and then run any of the shells from in there.

What I'd like to do is run powershell.exe via startmenu / win+r and have it open inside the new Windows Terminal instead of the old console, but I couldn't find any command line option for powershell.exe to enable that.

Is that even possible and if yes, how?

totkeks

Posted 2019-11-25T20:20:00.207

Reputation: 13

Is this what you want -- open Windows Terminal and it open Powershell Core by-default? – Biswapriyo – 2019-11-25T20:27:13.690

No, I want to open any powershell (or cmd) with the new windows terminal instead of the old console host/window. – totkeks – 2019-11-25T20:41:50.920

Windows Terminal uses PowerShell as its default shell. – harrymc – 2019-11-25T21:09:07.223

@harrymc please run powershell.exe and tell me, that it opens Windows Terminal for you. I described, that Terminal opens with Powershell, but I also want it the other way around for when I start powershell, it runs it inside terminal. – totkeks – 2019-11-25T21:56:30.817

@totkeks - When you mention "new windows terminal", you are talking about the optional UWP application that is currently in testing? HarryMC is talking about the fact the default terminal since 1803+ is indeed PowerShell instead of the Command Prompt. – Ramhound – 2019-11-25T23:10:30.693

@Ramhound, you mean default shell. But I mean the terminal application, the thing that draws the window for the shell. And I'd like to start Powershell inside of the new Windows Terminal instead of the old console application. I can add screenshots if that helps. – totkeks – 2019-11-25T23:25:11.507

@totkeks - You are talking about the terminal application that is in currently being tested? The application is open source. You can change the default behavior of it if you so desire. I was mistaken the application requires 1903 not 1803.

– Ramhound – 2019-11-25T23:30:38.303

@Ramhound, yes indeed. https://github.com/Microsoft/Terminal this one. Please see the comment I already gave the first commenter. Running Powershell as the default shell in Windows Terminal works. But I want to run powershell.exe inside the new terminal, when starting it via win+r or the startmenu or similar.

– totkeks – 2019-11-25T23:31:38.920

You mean that you don't want to adjust the way you call powershell, so you want Windows to modify its behavior instead. Seems exaggerated to me. – harrymc – 2019-11-26T09:59:34.450

Answers

0

As far as I know there is no way to changed the default console for PowerShell.exe yet.

If you just want a quick way to start powershell.exe in the new Windows Terminal, in the Win+R dialog or any other command line interface just type wt

This should open the new Windows Terminal and by default will have a PowerShell.exe loaded.

If you want to type PowerShell.exe to start the new terminal, you can use the Image File Execution Options hack:

reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\powershell.exe" /v Debugger /t REG_SZ /d "C:\users\yourusername\AppData\Local\Microsoft\WindowsApps\wt.exe" /f

This tells Windows to start wt.exe instead of powershell.exe. In this case it has to have your hardcoded username in the path, which may break PowerShell.exe for all other users so I don't recommend it.

wt.exe is not actually an executable, but a reparse point to the UWP Terminal application.

Peter Hahndorf

Posted 2019-11-25T20:20:00.207

Reputation: 10 677

Thanks for the detailed explanation! That really helped me a lot. Never heard about reparse points before. Also the shortcut wt is pretty useful and I guess that's quicker to type than powershell and also does what I wanted to achieve. – totkeks – 2019-11-26T21:11:00.500