批量Ping IP 地址并记录成功结果的bat脚本
@echo off setlocal enabledelayedexpansion
set 'input_file=1.txt' set 'output_file=2.txt' set 'success=false'
for /f "usebackq delims=" %%a in ('%input_file%') do ( ping -n 1 %%a >nul if !errorlevel! equ 0 ( set 'success=true' echo %%a>>'%output_file%' ) )
if not %success% equ true ( echo No successful pings found. )
pause>nul
原文地址: https://www.cveoy.top/t/topic/nCec 著作权归作者所有。请勿转载和采集!