'pwsh' is not recognized as an internal or external command, operable program or batch file
PowerShell used to be a Windows-only tool based on .NET Framework. Starting from
v6, PowerShell is an open-source, .NET Core-based solution you can run on Linux, MacOS, and Linux.
Starting from PowerShell
v7, the PowerShell executable has been renamed to
The binary name for PowerShell has been changed from
pwsh(.exe). This change provides a deterministic way for users to run PowerShell on machines and support side-by-side installations of Windows PowerShell and PowerShell.
Going forward, if you want to use
v7+ version (which should be the default approach), you need to use
pwsh instead of
powershell is also possible, but it will not work on non-Windows devices and will use Windows PowerShell v5 on Windows ones.
v7+ is not installed, you will get the following error:
'pwsh' is not recognized as an internal or external command, operable program or batch file.
Installing PowerShell v7 (and newer)
To fix the error above you need to install the new PowerShell. There are various ways to do it, but the easiest way for .NET developers is to execute the following command:
dotnet tool update --global PowerShell
It will update or install the latest version of PowerShell, and
pwsh command will be available in your command line.
- Cross-platform PowerShell was a natural reaction to cross-platform .NET Core.
- Starting from
v6you can run PowerShell anywhere.
v7the executable was renamed to
pwshto remove potential conflicts with legacy Windows PowerShell v5 which still uses
'pwsh' is not recognized...message indicates PowerShell
v7+is not installed.
- To install the latest PowerShell execute
dotnet tool update --global PowerShellin your command line.
- PowerShell documentation is here.