I am trying to run this command in windows:
ping -n 5 127.0.0.1 > nul
I get the error:
\'ping\' is not recognized as an
How to diagnose this error:
'ping' is not recognized as an internal or external command operable
program or batch fie.
Because your path
environment variable does not contain the directory that points to the executable: ping.exe
. So the question becomes why can't your command line program cmd.exe
locate ping.exe
?
You can print out your path variable on the commandline like this:
echo %PATH%
Which prints for me:
C:\WINDOWS;C:\WINDOWS\system32;C:\Program Files\jZip;C:\MinGW\bin
The above string is delimited by semicolons(;
). Notice the element called: C:\WINDOWS\System32
, that is the element that defines where ping.exe can be located.
Solutions
C:\WINDOWS\System32\ping.exe
, or replace ping.exe
.