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

前端 未结 3 1677
被撕碎了的回忆
被撕碎了的回忆 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:44

    You have overridden the PATH environment variable, so the command processor can no longer find the ping executable.

    The fix is nice and simple - just use a different variable name!

    :: set path
    SET MyPath=M:\\5.bmp
    
    :findfile
    IF EXIST %MyPath% (
    

    Please note that if you genuinely wanted to set the path environment variable, you should append to it like so:

    REM Set temporarily for this session
    SET PATH=%PATH%;C:\Some\Folder
    
    REM Set permanently (but note - this change will not be made to this session)
    SETX PATH=%PATH%;C:\Some\Folder
    

提交回复
热议问题