小编Sri*_*san的帖子

在批处理文件的“for”循环中使用“ping”和“findstr”首先会引发错误,不是内部外部命令,但它再次显示输出

这个批处理文件

@echo off
set path=C:\Users\ssiyengar\Desktop\Pingtest\pinglist.csv
set file=C:\Users\ssiyengar\Desktop\Pingtest\temp.txt
set qosping=1
cls
for /f "tokens=1-3 delims=," %%a IN (%path%) do (
    ping %%c -n %qosping% > %file%
    findstr "time< time=" %file% >nul
    if %errorlevel%==1 (
    echo %%a  %%b IP %%c Ping FAILURE
    ) else (
    echo %%a  %%b IP %%c Ping SUCCESS
    )
)
pause
Run Code Online (Sandbox Code Playgroud)

输出:

'ping' is not recognized as an internal or external command,
operable program or batch file.

'findstr' is not recognized as an internal or external command,
operable …
Run Code Online (Sandbox Code Playgroud)

batch ping batch-file findstr

6
推荐指数
1
解决办法
3214
查看次数

标签 统计

batch ×1

batch-file ×1

findstr ×1

ping ×1