samedi 6 juin 2015

Batch Random Pinging(Trying to determine if a ping is successful)

I have made a program that creates random IPs and pings them to see if they exist. It records the output using '>' and '>>'. I want to check if the ping times out and if it does exclude it from the text document. This is my code so far:

`@ECHO OFF
:LOOP
 SET /A N1=%RANDOM% * 255 / 32768
 SET /A N2=%RANDOM% * 255 / 32768
 SET /A N3=%RANDOM% * 255 / 32768
 SET /A N4=%RANDOM% * 255 / 32768
 PING %N1%.%N2%.%N3%.%N4%>>"%USERPROFILE%\Desktop\IP.txt"
 GOTO LOOP`

After the ping is done I want it to record IPs that respond, not the ones that time out.

-Thanks in advance




Aucun commentaire:

Enregistrer un commentaire