Computing.Net > Forums > Programming > Batch to Ping

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

Batch to Ping

Reply to Message Icon

Name: WASDGuido
Date: November 18, 2008 at 06:09:38 Pacific
OS: Win Xp Pro
CPU/Ram: 1 Gb
Manufacturer/Model: HP2200
Comment:

Hello!

I have a lot of machine inactives in the Domain, i have a list of computer (Inactive) and i want a batch to do:

ping a computer from a list
(example: ping WASDGuido)
ping -a the WASDGuido'ip

I wanna do this because we'r having a little trouble with DNS Server.

Example: Ping WASDGuido = IP: 100.100.100.100
ping -a 100.100.100.100 = GuidoDSAW

I have this but is incomplete i dont know how i can extract the ip from the txt and do the "ping -a"
@echo off
for /f "tokens=1 delims=" %%a, in (scan.txt) do ping.exe -n 1 -l 32 %%a >> pingcheck.txt

Thanks in advance!
PD: Sorry for my english!

Guido.

Always @ W0rK


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 18, 2008 at 21:38:07 Pacific
Reply:

Post a few lines of scan.txt


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 2
Name: WASDGuido
Date: November 19, 2008 at 04:28:39 Pacific
Reply:

Here is it...

A08640B7
ACPC000001
ADAOP_ADM_W2W
ALLES2-TTT-WXP
ALMAN-SIS-WXP
AMOEL-SIS-W2W
ANROP_SIS_W2W
ATEN-BE85BE29
HP2200-SI
bane159
This a one column, without any space in the computer's names

Thanks Mechanix.

Regards.

Always @ W0rK


Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: November 19, 2008 at 05:56:04 Pacific
Reply:

The script below should give you lines like this one:

Pinging ABC [192.168.1.2] with 32 bytes of data:

=======================================
@echo off

for /f "tokens=1 delims=" %%a in (scan.txt) do (
ping.exe %%a | find "Pinging" >> pingcheck.txt
)


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Response Number 4
Name: WASDGuido
Date: November 19, 2008 at 07:14:33 Pacific
Reply:

@echo off

for /f "tokens=1 delims=" %%a in (scan.txt) do (
ping.exe %%a | find "Haciendo ping a" >> pingcheck.txt
)
==========================================

I changed the "Pinging" to "Haciendo ping a" This is Win XP in Spanish. Anyway, it's working...Now i have to ping -a the IP that i have in that TXT.

"Haciendo ping a TTTT-TTT-TTT.XXXX.XXX.XX [100.100.100.100] con 32 bytes de datos:"
The IP is "tokens=5 delims= " ??

Thanks!

Regards

Always @ W0rK


Report Offensive Follow Up For Removal

Response Number 5
Name: Mechanix2Go
Date: November 19, 2008 at 07:33:28 Pacific
Reply:

I think you're right that you need tokens=5

You also ned to get rid of the brackets, so try this:

for /f "tokens=5 delims=[] " %%a in (pingcheck.txt) do (
ping %%a
)


=====================================
If at first you don't succeed, you're about average.

M2


Report Offensive Follow Up For Removal

Related Posts

See More



Response Number 6
Name: WASDGuido
Date: November 19, 2008 at 12:10:31 Pacific
Reply:

@echo off

for /f "tokens=1 delims=" %%a in (scan.txt) do (ping.exe -n 1 -l 32 %%a | find "Haciendo ping a" >> pingcheck.doc
)
for /f "tokens=5 delims=[] " %%a in (pingcheck.doc) do (ping.exe -a -n 1 -l 32 %%a | find "Haciendo ping a" >> pingediptohost.doc
)

============================================

ITS WORKING!!! The only thing that i have to do is compare the two files.doc and see what computers are inactive, pretty simple, the hard work is done! Maybe another day ill try to do a bat that compare the files or put the results in two colums in an excel file :D

THANK YOU Mechanix!!

PD: Ill send u an "Asado" (tipic food from Argentina)and two beers for this great help! :P

Regards!
Guido.

Always @ W0rK


Report Offensive Follow Up For Removal
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch to Ping

Batch to Ping Help www.computing.net/answers/programming/batch-to-ping-help/15840.html

Batch to show error message if PING fails? www.computing.net/answers/programming/batch-to-show-error-message-if-ping-fails/19086.html

batch files , ping results www.computing.net/answers/programming/batch-files-ping-results/14790.html