Windows Batch error: “'ping' is not recognized as an internal or external command operable program or batch file.”

前端 未结 3 1645
被撕碎了的回忆
被撕碎了的回忆 2021-01-20 17:03

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          


        
3条回答
  •  [愿得一人]
    2021-01-20 17:45

    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

    1. You didn't specify C:\WINDOWS\System32 in your path variable. Make sure it is there.
    2. ping.exe is missing. Find out who deleted it and put it back.
    3. ping.exe is corrupt. Run it where it sits: C:\WINDOWS\System32\ping.exe, or replace ping.exe.
    4. You have overridden the PATH variable before you look for it.

提交回复
热议问题