Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 410
  • Last Modified:

batch file to ping ips and store in text file

hi sorry for mimimal info , suffer from rsi

from this thread
http://www.experts-exchange.com/Programming/System/Windows__Programming/Q_22144788.html?sfQueryTermInfo=1+batch+ip+multipl+ping

i created batch file called pingwaps with this syntax
For /f %a in (C:\Computers.txt) do ping %a -n 2 >> C:\Ping_Results.txt

created txt file with one ip address 10.122.224.52  
when i run it
i get
C:\>pingwaps.bat
do was unexpected at this time.

C:\>For /f \Computers.txt) do ping \Ping_Results.txt
C:\>

can you tell me where i am going wrong
ta


0
exdos
Asked:
exdos
1 Solution
 
Todd GerbertIT ConsultantCommented:
In a batch file you need to use double percent signs.  On the command line it works as you have it writtent, but in a .BAT or .CMD file it needs to be:

For /f %%a in (C:\Computers.txt) do ping %%a -n 2 >> C:\Ping_Results.tx
0
 
exdosAuthor Commented:
thank you it worked just as you said
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now