Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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'ipI 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 = GuidoDSAWI 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.txtThanks in advance!
PD: Sorry for my english!Guido.
Always @ W0rK
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
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 namesThanks Mechanix.
Regards.
Always @ W0rK
Report Offensive Follow Up For Removal
The script below should give you lines like this one:
Pinging ABC [192.168.1.2] with 32 bytes of data:
=======================================
@echo offfor /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
@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
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
@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
![]() |
![]() |
![]() |

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