batch file to ping ips and store in text file

Posted on 2009-02-11
Last Modified: 2013-12-03
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

Question by:exdos
    LVL 33

    Accepted Solution

    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

    Author Closing Comment

    thank you it worked just as you said

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now