HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Make pinging faster while looking for a Windows PC

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
whilepingingmakefasterlookingforwindows

Problem

This code pings 1 time every IP while using TTL to identify if it's a Windows PC. If so, it outputs it. It's very slow, so is there any way to make it go faster (1-255 in 12 min)?

@echo off
echo running, it will take a long time to scan
(
  FOR /L %%N in (1 1 254) DO (
      FOR /f "tokens=1,3 delims=: " %%A IN ('ping -n 1 192.168.250.%%N ^| find "TTL=128"') DO ECHO %%B

  )
) >ip.txt

echo done
get_info.bat

Solution

You will have to reduce the timeout interval with the -w option (milliseconds), but I don't know what is the minimum timeout that still gives reliable results.

You could try

ping -w 500 -n 1 192.168.250.%%N

Code Snippets

ping -w 500 -n 1 192.168.250.%%N

Context

StackExchange Code Review Q#116779, answer score: 2

Revisions (0)

No revisions yet.