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

  • 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

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  
when i run it
i get
do was unexpected at this time.

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

can you tell me where i am going wrong

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
exdosAuthor Commented:
thank you it worked just as you said

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