The error is an internal or external command. "Filename" is not an internal or external command, executable program, or batch file
Very often, novice programmers encounter such an error as "", if you also encountered this error and are looking for a solution, then you have come to the right place. In this article we will talk about What causes this error and how to solve it.
So this error appears when entering a certain php command on the command line. For example, I'll try to enter a command that will show me current version Laravel framework. But as a result I get this error:
Fig 1. Error - php is not an internal or external command
I will get the same error if I try to run any other php command of the Laravel framework or any other framework.
It will also appear if I try, for example, to install composer using command line.
In general, this error will appear when entering any commands that begin with the key php words. And it appears because the PATH environment variable is not configured.
How to fix this error?
To fix this error, you need to set the PATH environment variable to the path to the php.exe application, which is located inside your local server folder.
This means that in order to get to the value of the PATH variable in Windows 7, you need to take the following steps:
1. On the desktop, right-click the mouse and click on the icon " My computer"or it may simply be called" Computer". And select the item " Properties".
Fig 2. Open computer properties
2. In the window that appears, click on the item Additional options systems.
Figure 5. PATH environment variable
As a result, another small window will appear, where you need to enter the desired path.
Fig 6. PATH variable value
Now, at the beginning of the value of this variable, you need to add the path to the folder on the local server where the application is located php.exe.
You need to find this folder on your local server and specify the path to it.
I have it local server WAMP, which is installed in the root of drive D. This means that the path to the folder with the php.exe application will be like this:
D:\wamp\bin\php\php5.6.25;
Fig 7. Path to the php.exe application
Comment! Please note that you must include a semicolon at the end of the path.
Fig 8. Setting the path to php in the PATH environment variable
Now press the button OK, then again OK and again OK.
After these steps, reboot the computer.
If you want to use another version of PHP that is available on your server, then set the environment variable to the path to the folder of this version. Or, you can add both paths to both versions.
Well, that's all the path to the php.exe application has been added to the PATH environment variable. The php command on the command line should now work.
I'll try again to find out the version of the installed Laravel framework.
Fig 9. Find out the version of the Laravel framework
And voila, everything works, the error has disappeared. This concludes this small but very useful article. Now you know how to solve the error" php is not an internal or external command" and you can continue to enter the necessary php commands into the command line.
When trying to open any command through a window utility program or console, you encounter an error - "File name" is not an internal or external command executable by a program or batch file. The system stubbornly does not open the file for some reason and this fact is very annoying. The reason for this may be one of several options: the path to the file is incorrectly specified and the absence of a component in the system at all, i.e. specified address it doesn't exist.
The main reasons why the error “is not an internal or external command” appears
As already mentioned, one of the reasons is that the path to the file to be opened is incorrect. Usually the path to the file is specified in the “Path” variable in the system; the strict path to the directory in which the files are located must be specified. necessary files. If there are any errors in the settings when specifying a path in a variable, or when specifying a file name, then the system will generate exactly this error - “file name” is not an internal or external command executed by the program.
The first step is to specify the exact path of the “Path” variable to the operating system so that errors do not occur when opening the file. To do this, you need to know the location of the folder for sure. For example, let's turn to a program that will later work with executable file in a specific folder.
The Path variable is an operating system variable that is used to locate specified executable objects via the command line or terminal. You can find it in the panel Windows management. In new Windows versions and other operating systems, specifying manually is usually not required.
Specify the correct path in the path variable on Windows 7
To correctly specify the path, you need to know the exact location of the file. If the program file that needs to be opened is located on the disk in C:\Program Files\Java\jdk 1.8.0.45\bin, then this path must be copied and specified in the system variable for subsequent opening.
![](https://i2.wp.com/lifehacki.ru/wp-content/uploads/2017/10/4-3.jpg)
If the error appears again, try moving the program to the working directories of the disk with the installed operating system eg /System32. Windows works with this directory more often.
Errors also occur due to missing program components. You can eliminate them by adding the necessary ones. Let's take the Telnet component as an example. To enable it, go to:
![](https://i1.wp.com/lifehacki.ru/wp-content/uploads/2017/10/2-2.png)
Set the “Path” variable in Windows 8/8.1/10
- Go to the “Control Panel”.
- Click the “Advanced system settings” link.
- We find " Environment Variables" In this section you need to select “Path”. Next, “Change”, if there is no ready one, create it again.
- In the “Change system variable” item, specify the value you need and confirm with the “Ok” button. Close all other windows by clicking “Ok”.
- Reopen the command line or terminal and try your query again. Everything should work fine now.
In adim 08.10.201708.10.2017
4 -5 minutes
P When you try to open any command through a utility window or console, you encounter an error - “File name” is not an internal or external command, executable program or batch file. The system stubbornly does not open the file for some reason and this fact is very annoying. The reason for this may be one of several options: the path to the file is incorrectly specified and the absence of a component in the system at all, i.e. it does not exist at the specified address.
Error in system variable
ABOUT The main reasons why the error “is not an internal or external command” appears
As already mentioned, one of the reasons is that the path to the file to be opened is incorrectly specified. Usually the path to the file is specified in the “Path” variable in the system; the strict path to the directory in which the necessary files are located must be specified. If there are any errors in the settings when specifying a path in a variable, or when specifying a file name, then the system will generate exactly this error - “file name” is not an internal or external command executed by the program.
The first step is to specify the exact path of the “Path” variable to the operating system so that errors do not occur when opening the file. To do this, you need to know the location of the folder for sure. For example, let's turn to a program that will subsequently work with an executable file in a specific folder.
The "Path" variable is an operating system variable that is used to locate specified executable objects via the command line or terminal. You can find it in the Windows Control Panel. In new versions of Windows and other operating systems, manual instructions are usually not required.
Path System Variable
U indicate the correct path in the path variable on Windows 7
To correctly specify the path, you need to know the exact location of the file. If the program file that needs to be opened is located on the disk in C:\Program Files\Java\jdk 1.8.0.45\bin, then this path must be copied and specified in the system variable for subsequent opening.
- Next, we need a desktop, point the mouse at “My Computer” and context menu select “Properties”.
- Click "Advanced options" on the left and select "Environment Variables".
- In the window that opens, look for the “Path” line, click on it and paste the copied path here.
- The action must be confirmed with the “Ok” button. It is advisable to restart the computer for the settings to take effect. Open the console and enter the required command. There shouldn't be any mistakes.
Command line
If the error appears again, try moving the program to the working directories of the disk with the operating system installed, for example /System32. Windows works with this directory more often.
Errors also occur due to missing program components. You can eliminate them by adding the necessary ones. Let's take the Telnet component as an example. To enable it, go to:
- On the "Control Panel".
- Next, select “Turn components on or off.”
- From the list select " Telnet client", check the opposite box and click "Ok".
- The component should work and no more errors should occur.
Windows Telnet Component
Z Set the “Path” variable in Windows 8/8.1/10
- Go to the “Control Panel”.
- Click the “Advanced system settings” link.
- Find "Environment Variables". In this section you need to select “Path”. Next, “Change”, if there is no ready one, create it again.
- In the “Change system variable” item, specify the value you need and confirm with the “Ok” button. Close all other windows by clicking “Ok”.
- Reopen the command line or terminal and try your query again. Everything should work fine now.