93

I want to set PowerShell 7 as the default shell. So when I shift right click in File Explorer and click on "Open PowerShell window here" in the context menu, I want PowerShell 7 to come up.

And I want to remove completely the other versions.

Is there anyway to do that?

8
  • 1
    [1] you CANNOT remove ps5.1 - it is required by several things in windows. [grin] ///// [2] the installer for ps7+ has an option to add it to the context menu. have you tried re-running the installer?
    – Lee_Dailey
    Commented Mar 2, 2021 at 21:53
  • 4
    This is not a PowerShell code issue. Which is why we are here. SO has rules we are told we are to follow: Provide MRE --- How to ask --- Don't ask --- Proper Topic --- Why not upload images of code/errors?
    – postanote
    Commented Mar 2, 2021 at 21:55
  • 1
    You can set PowerShellv7 (PWSH.exe) as your default. You cannot uninstall the versions that ship with the OS (Windows PowerShell -- powershell.exe and powershell_ise.exe); that is by design;, nor would you want to as PSv7 is not 100% on par with Win PS, and will call those cmdlets, for the ones it does not have. Mkaing changes to the registry for context menu stuff, set the file associate of all .ps* to pwsh.exe, put the pwsh.exe icon as a shorcut on your desktop and only use that.
    – postanote
    Commented Mar 2, 2021 at 21:56
  • 1
    On install PS7 on right-click is an option. Without messing with the registry, you can set pin the pwsh shortcuts to your desktop, set pwsh in default applications or in Explorer, right-click .ps file (not recommended - .ps is set to a text editor for a reason); pin it to the Start Menu, and remote the PowerShell shortcuts from your desktop, and the Start Menu, VSCode, to always use push in the user settings, same thing the Windows Terminal. As for Open here, WinX Menu, and right-click in explorer, you have to modify the registry. There are web articles showing how to do the reg hack.
    – postanote
    Commented Mar 2, 2021 at 22:38
  • 1
    @Bilal - good to know you got the ps7+ stuff working. [grin] ///// take a look at dsim.exe and sfc.exe for ways to possibly fix your ps5.1 setup.
    – Lee_Dailey
    Commented Mar 2, 2021 at 22:50

4 Answers 4

58

To make PowerShell 7 the default shell for Windows Terminal, follow these steps:

  1. Click on the down arrow and press settings
  2. A json file will open, and you will see a line near the top that has a parameter called defaultProfile with a UUID. (You may have to click the 'Open JSON file' button first, on the settings UI that opens)
  3. Also you will see a line representing the UUID of the PowerShell 7.0
  4. Copy that UUID and put it in for defaultProfile

Good Luck!

Source:

https://www.codyhosterman.com/2020/05/defaulting-windows-terminal-to-powershell-7-x-core/

The Down Arrow Menu and Settings

Open JSON file button

enter image description here

13
  • 43
    I don't see the option down arrow to press settings!.
    – Bilal
    Commented Mar 2, 2021 at 23:57
  • 4
    You can try to access the file settings.json directly from here [update the path accordingly in your computer]: C:\users\$env:UserName\AppData\Local\Packages\Microsoft.WindowsTerminal_*\LocalState\settings.json
    – ALUFTW
    Commented Mar 3, 2021 at 0:03
  • 2
    I don't have this file, I maybe delete it by mistake before, so I don't have functional core PS.
    – Bilal
    Commented Mar 3, 2021 at 0:07
  • 3
    @Bilal, do you have Windows Terminal and VSCode installed? The dropdown arrow, ALUFTW is part of the Windows Terminal GUI, it can't be removed that I am aware of and should not even if one could. Since it is what allows access to all configured shells.
    – postanote
    Commented Mar 3, 2021 at 3:06
  • 5
    Nowhere in the question does it mention terminal, yet this answer right away assumes the OP wants to remove from terminal. And this is the accepted answer! SO has become strange these days. Commented Mar 10, 2023 at 1:29
22

If you have Windows Terminal: Follow these steps: Click the dropdown and go to Settings

On the General Tab, you will see default profile, click the dropdown and select the profile you would like to be default Windows terminal screen to selext default profile

5
  • 5
    ... "and I want to remove completely the other versions" Commented Dec 3, 2021 at 0:35
  • Anyway to fix the mouse right click context menu 'run as PowerShell"?
    – Yiping
    Commented Mar 16, 2022 at 4:34
  • 1
    Powershell 7 does not show up even after installing it and rebooting (Windows 11)
    – jjxtra
    Commented Jan 22, 2023 at 19:41
  • Type in the search bar 'Powershell7' and it will show up. I have it pinned to my task bar.
    – chikega
    Commented Jul 4, 2023 at 21:40
  • Do you mean this windows terminal and / or this github repo?
    – surfmuggle
    Commented Sep 29, 2023 at 10:55
11

As of 2023.3.30 - for windows 11

  • Install PowerShell from windows store.
  • Open terminal
  • click little dropdown arrow and choose settings
  • change default to the new PowerShell logo (not Windows PowerShell)
  • click save and then close and restart terminal

enter image description here

2
  • deadly hurt, it's true
    – Tien Dang
    Commented Mar 5 at 9:55
  • Part of the confusion is that pwsh.exe version 7 just calls itself "PowerShell" which is not helpfully distinct from the old "Windows PowerShell" name. Probably due to the fact that pwsh is now available on Linux.
    – MarkHu
    Commented Apr 5 at 17:09
-2

to change powerShell version in windows 11, follow these steps

  1. Open powerShell and go to setting by clicking down arrow
  2. in Profiles tab (left side in menu) choose Windows PowerShell
  3. edit the Command Line to powerShell Directory Like C:/Program Files/PowerShell/7/pwsh.exe
  4. Save settings

that's it

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.