batch file - How do I get a randomly generated ip back from ping -
what want generate random ip, ping it, , then, if ip comes valid ip, want send ip new notepad. have far...
:start @set /a a=(%random% * 99 / 32768 + 1) @set /a b=(%random% * 999 / 32768 + 1) @set /a c=(%random% * 999 / 32768 + 1) @set /a d=(%random% * 9 / 32768 + 1) @set e=%a%.%b%.%c%.%d% ping %e% goto start
i make take ip pinged, , if comes valid, put in notepad. thanks! want able repeat. please leave comment if know how can correctly!
@echo off setlocal enableextensions enabledelayedexpansion /l %%a in (0) ( set /a "a=!random! %% 255", ^ "b=!random! %% 255", ^ "c=!random! %% 255", ^ "d=!random! %% 255" ping -w 1000 -n 1 "!a!.!b!.!c!.!d!" | find "ttl=" > nul && ( >>"online.txt" echo !a!.!b!.!c!.!d! ) )
Comments
Post a Comment