# .bat to ping multiple computers from text file and output results to text file



## mcranda (Jul 29, 2016)

Here is the code I have so far.  The .bat file is picking up the file I want with all my IP addresses (IPS.txt), however, I am wanting my ping results to be in a text file ping.txt.  If at all possible I would only like to see the IPs that "failed to respond".


```
@echo off
FOR /F "tokens=*" %%I in (C:\Users\VHAFARMcdouM\Ips.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond) 
pause
```

Thank you


----------



## RedBeard (Jul 30, 2016)

Go with powershell instead. https://social.technet.microsoft.co...-ip-address-and-email-name-if-down?forum=ITCG


----------

