cunoc
asked on
Ping from (192.168.1.1 - 192.168.1.254) without using IPlist.txt and output the result with Hostnames..
Hi,
I want to ping all computers in the range of (192.168.1.1 - 192.168.1.254) without using the "IPlist.txt".
When done; the output - I want to see is only the PCs that (0% loss) .. with the PC's Hostname.
Any PCs that "100% loss", I don't want to see.
Thanks
Here is the output, I want it looks like on the screen.
Hostnames are availables in your LAN:
192.168.1.1 --> MyPC1 Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.254 --> MyPC254 Packets: Sent = 1, Received = 1, Lost = 1 (0% loss),
////////////////////////// ////////// ////////// ////////// ////////// ////
@echo off
for /f %%p in (IPlist.txt) do (
echo %%p
ping -n 1 -w 100 -a %%p |find /i "Packet"
)
////////////////////////// ////////// ////////// ////////// ////////// ////
192.168.1.1
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.2
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
...
...
...
192.168.1.254
Packets: Sent = 1, Received = 1, Lost = 1 (0% loss),
I want to ping all computers in the range of (192.168.1.1 - 192.168.1.254) without using the "IPlist.txt".
When done; the output - I want to see is only the PCs that (0% loss) .. with the PC's Hostname.
Any PCs that "100% loss", I don't want to see.
Thanks
Here is the output, I want it looks like on the screen.
Hostnames are availables in your LAN:
192.168.1.1 --> MyPC1 Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.254 --> MyPC254 Packets: Sent = 1, Received = 1, Lost = 1 (0% loss),
//////////////////////////
@echo off
for /f %%p in (IPlist.txt) do (
echo %%p
ping -n 1 -w 100 -a %%p |find /i "Packet"
)
//////////////////////////
192.168.1.1
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.2
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
...
...
...
192.168.1.254
Packets: Sent = 1, Received = 1, Lost = 1 (0% loss),
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
@echo off
for /l %%p in (1,1,20) do (
echo 192.168.1.%%p
ping -n 1 -w 50 -a 192.168.1.%%p |find /i "Packet" |find /i "(0%% loss)"
)
PAUSE ..
////////////////////////// ////////// //
192.168.1.1 <---------------------(I need to have the Hostnames for the output...)
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
192.168.1.7
192.168.1.8
192.168.1.9
192.168.1.10
192.168.1.11
192.168.1.12
192.168.1.13
192.168.1.14
192.168.1.15
192.168.1.16
192.168.1.17
192.168.1.18
192.168.1.19
192.168.1.20
Press any key to continue . . .
@echo off
for /l %%p in (1,1,20) do (
echo 192.168.1.%%p
ping -n 1 -w 50 -a 192.168.1.%%p |find /i "Packet" |find /i "(0%% loss)"
)
PAUSE ..
//////////////////////////
192.168.1.1 <---------------------(I need to have the Hostnames for the output...)
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
192.168.1.7
192.168.1.8
192.168.1.9
192.168.1.10
192.168.1.11
192.168.1.12
192.168.1.13
192.168.1.14
192.168.1.15
192.168.1.16
192.168.1.17
192.168.1.18
192.168.1.19
192.168.1.20
Press any key to continue . . .
ASKER
Hi, billprew:
Here is the result, when I executed your code ...
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,50) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 192.168.1.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
192.168.1.1, 192.168.1.1 (<------------------------ What wrong in this part)
192.168.1.33, PC-641788.linksys.com
192.168.1.35, 192.168.1.35 (<------------------------ What wrong in this part)
Press any key to continue . . .
Here is the result, when I executed your code ...
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,50) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 192.168.1.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
192.168.1.1, 192.168.1.1 (<------------------------
192.168.1.33, PC-641788.linksys.com
192.168.1.35, 192.168.1.35 (<------------------------
Press any key to continue . . .
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, billprew:
I got the result, when I executed your code ...
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,35) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 192.168.1.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
192.168.1.1, 192.168.1.1 (<------------------------ What wrong in this part)
192.168.1.33, PC-641788.linksys.com
192.168.1.35, 192.168.1.35 (<------------------------ What wrong in this part)
Press any key to continue . . .
I got the result, when I executed your code ...
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,35) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 192.168.1.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
192.168.1.1, 192.168.1.1 (<------------------------
192.168.1.33, PC-641788.linksys.com
192.168.1.35, 192.168.1.35 (<------------------------
Press any key to continue . . .
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi billprew:
You are 100% right.....,
////////////////////////// ////////// ////////// ///////
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,60) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 209.191.93.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
////////////////////////// ////////// ////////// ///////
192.168.1.3, dhfedc3.data.mud.yahoo.com
192.168.1.4, dhfedc4.data.mud.yahoo.com
192.168.1.5, dhfedc5.data.mud.yahoo.com
192.168.1.12, web236.address.pim.mud.yah oo.com
192.168.1.13, web237.address.pim.mud.yah oo.com
192.168.1.14, web238.address.pim.mud.yah oo.com
192.168.1.19, rl1.yosmsg.vip.mud.yahoo.c om
192.168.1.21, m-qa5.media.mud.yahoo.com
You are 100% right.....,
//////////////////////////
@echo off
setlocal EnableDelayedExpansion
for /l %%A in (1,1,60) do (
for /f "tokens=1-10 delims==, " %%B in ('ping -n 1 -w 100 -a 209.191.93.%%A') do (
if "%%B"=="Pinging" set Host=%%C
if "%%B"=="Packets:" if "%%I"=="(0%%" echo 192.168.1.%%A, !Host!
)
)
PAUSE ..
//////////////////////////
192.168.1.3, dhfedc3.data.mud.yahoo.com
192.168.1.4, dhfedc4.data.mud.yahoo.com
192.168.1.5, dhfedc5.data.mud.yahoo.com
192.168.1.12, web236.address.pim.mud.yah
192.168.1.13, web237.address.pim.mud.yah
192.168.1.14, web238.address.pim.mud.yah
192.168.1.19, rl1.yosmsg.vip.mud.yahoo.c
192.168.1.21, m-qa5.media.mud.yahoo.com
ASKER
Hi,
Thank you all of your work.
Thank you all of your work.
I'm a bit confused. The proposed accepted solution is just a cut and paste of my script by the OP saying it worked. Seems like my post of 26173590 should have been the accepted solution. If the OP wants to assign some assists they are welcome too, just seems contrary to EE protocol the way it is being closed.
~bp
~bp
ASKER
Here is the result I got, I don't see the IPs and Hostnames ...
@echo off
for /l %%p in (1,1,40) do (
echo %%p
ping -n 1 -w 100 -a 192.168.1.%%p |find /i "Packet"
)
PAUSE ..
1
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
2
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
...
...
254
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),