Posted by Kosal
Are you facing the error "'pwsh' is not recognized as an internal or external command, operable program, or batch file" when trying to use PowerShell Core on your system? This common issue can be frustrating, but fear not – there's a simple solution.
The Problem:
The error message indicates that your system is unable to locate the pwsh
executable, which is the command-line interface for PowerShell Core. This typically happens when the installation directory of PowerShell Core is not added to your system's PATH environment variable.
The Solution:
Thankfully, resolving this issue is straightforward. You can quickly fix it by updating the global PowerShell tool using the .NET CLI (dotnet
). Here's how:
dotnet tool update --global PowerShell
This command updates the global PowerShell tool to the latest version available, ensuring that pwsh
is correctly installed and accessible from any directory on your system.
pwsh
in your terminal or command prompt, and if everything is set up correctly, PowerShell Core should start without any errors.Additional Notes:
By following these steps, you should be able to resolve the "'pwsh' is not recognized" error and use PowerShell Core seamlessly on your system.