I don't know exactly what you're trying to get at here. I made a program that will take your IP or host name and ping it with a user determined packet size, and amount of times to ping. I only tried 1.1.1.1 and www.google.com, but it should work for anything else.
@echo off
@title Pinger v1.1
color B
setlocal EnableDelayedExpansion
:ipInput
cls
set /p tryIP=Target IP:
:: pinging ip once (-n 1) with one byte of data (-l 1) to check if it's valid
ping -n 1 -l 1 !tryIP! >nul & if errorlevel 1 (
echo IP: !tryIP! is invalid, try correcting your input or using a different IP
pause
goto ipInput
)
cls
echo IP: !tryIP! is Valid
set /p pingCount=Enter number of pings:
set /p packets=Enter packet size:
echo Pinging !tryIP! with !packets! bytes for !pingCount! time^(s^)
:: You can either use this line (beneath)
REM ping -n !pingCount! -l !packets! !tryIP!
:: Or you can use this for loop from here.........
:: for /l indicates type of operation in this case it will take (start at, add or
subtract by, end at)
:: %%a in this case, based on /l will always equal the number
:: of times it's looped through..
:: (starting at 1, moving up by 1 each time, and ending after 32)
for /l %%a in (1,1,%pingCount%) do (
ping -n 1 -l !packets! !tryIP! >nul
cls
echo Pinging !tryIP! with !packets! bytes for !pingCount! time^(s^)
set /a percentage=%%a*10000/!pingCount!
if !percentage! LSS 100 echo ......!percentage:~0,0!.!percentage:~0,2!%%
if !percentage! GEQ 100 if !percentage! LSS 1000 echo ......!percentage:~0,1!.!percentage:~1,2!%%
if !percentage! GEQ 1000 echo ......!percentage:~0,2!.!percentage:~2,2!%%
)
:: the if statements are used to correct the formating on the percentages
:: since batch can't use floating point decimals,
:: you have to get a little creative sometimes.
:: dual % signs are so it doesn't think you're trying to set a variable
:: using ( or ) without that >>>^ (eg on lines 20 and 34)
:: will sometimes mess things up.
:: ........ to here. the benefit of a for loop is that you can see your progress,
:: and it's much much faster as the ping command will wait between pings.
echo Done
pause
goto ipInput