You might have encountered an error while running a PowerShell command. The error is labeled as “PowerShell is not recognized as an internal or external command error.”
This might be a head-scratching issue since you have no clue what’s happening on PowerShell. But, there’s a fix for it.
You need to modify the PATH environment variable. Afterward, include the directory containing the PowerShell executable. Before that, let’s get familiar with the causes.
Table of Contents Show
Causes of “PowerShell is Not Recognized as an Internal or External Command” Error:
There are a few potential causes for the “PowerShell is Not Recognized as an Internal or External Command” error. The error is generated due to various reasons. Here we will discuss some of them.
One possibility is that the PowerShell executable is not in the system’s PATH environment variable. This can happen if PowerShell is installed in a non-standard location.
Another possibility may be that the PowerShell execution policy is set to “Restricted”. This will prevent PowerShell scripts from running.
Finally, it might also be possible that the PowerShell script itself is not syntactically correct. This will display the cause of this error.
How to fix the “PowerShell is Not Recognized as an Internal or External Command” Error?
We will be trying to look at these solutions in the order of the severity of our issue. Starting up from the most common solution:
Check the Spelling or Syntax of the Command
Sometimes you have been facing this issue because of the incorrect syntax of the command you intend to execute. This incorrect syntax or spelling can spoil the intended purpose of the command execution.
To prevent this issue in the first place, always double-check your syntax and spelling of the command before running it.
Add the Path Environment Variable
Adding the PATH environment variable can also be an important option that you can implement to solve this error. To add the environment variable follow these steps:
- Search “Environment Variables” in the search bar.
- Click on “Edit the system environment variables” on the windows search menu.
- Upon clicking on the option, you will see a window. Click on the “Environment Variables” located in the bottom right corner.
- Under System variables select Path. Then, click the “Edit” option.
- Click “New” located on the top right side of the dialog box to add a new Path.
- Type the following code and click on OK.
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0
- Close the PowerShell. Then restart your PC in order to save changes.
Things to consider before adding the PATH environment variable:
It appears that fixing the problem involves adding PowerShell to the PATH. There is a drawback, though, that should be taken into account. Not everyone is interested in adding PowerShell to the path as a solution. If the users have no problem regarding this, they shall proceed with the process.