What is the difference between [pwsh] and [Powershell Integrated Console] on VS Code?
What is the difference between [pwsh] and [Powershell Integreted Console] on VS Code?
I usualy use pwsh.
Today, when I installed the powershell extension and then tried to update the powershell, the Powershell Integreted Console started up and found out. What is this?
-
pwsh[.exe]
is the executable file name of PowerShell [Core] (v6+), the cross-platform edition of PowerShell built on .NET Core / .NET 5+; by contrast,powershell.exe
is the executable name of the legacy Windows PowerShell edition (v5.1-), built on the Windows-only .NET Framework (v4.8-)- Windows PowerShell comes with Windows itself, whereas PowerShell [Core] must be installed on demand (on all supported platforms).[+]
-
VSCode (Visual Studio Code) has an integrated terminal (console) that can run any shell, such as
cmd.exe
,bash
, orpwsh
orpowershell
.- Shells that run in the integrated terminal by default have no special integration with the files being edited. They show by their executable file name in the dropdown list in the integrated terminal's toolbar; e.g.:
-
By contrast, the PowerShell Integrated Console is a special shell that comes with the PowerShell extension and offers integration with PowerShell code being edited, notably to provide linting and debugging support, among other features.
-
The PowerShell Integrated Console starts on demand when you first open/activate an editor with PowerShell code in a session, and it shows as follows in the integrated terminal's toolbar:
-
You can use the PowerShell extension's configuration to choose to select the specific PowerShell executable to use, which on Windows allows you to choose between running PowerShell [Core] (
pwsh.exe
) and Windows PowerShell (powershell.exe
) in the PowerShell Integrated Console.-
If a PowerShell [Core] version is installed and it is installed in a well-known location[*], it will be used by default; the fallback on Windows is Windows PowerShell. Since PowerShell [Core] versions can be installed side by side, you can switch between different versions, if installed.
-
If a PowerShell [Core] version in installed in a nonstandard location and is therefore not discovered automatically, you can tell the PowerShell extension where to find it via
settings.json
, as shown in the linked topic and the bottom section of this answer. -
The status bar in the bottom-right corner shows the PowerShell version that is being used (versions >= 6 imply PowerShell [Core]; you can click on the version number to switch to a different version); e.g.:
-
-
[+] as of v7.0; time will tell if PowerShell [Core] will ship with future versions of Windows, and perhaps even other platforms.
[*] From the linked docs: "This feature looks at a few well-known paths on different operating systems to discover install locations of PowerShell. If you installed PowerShell to a non-typical location, it might not show up initially in the Session Menu. You can extend the session menu by adding your own custom paths." If you use one of the official installers, the PowerShell extension should find your installation.