I need a batch file

Discussion in 'OT Technology' started by SixFour, Sep 15, 2004.

  1. SixFour

    SixFour Get on your knees and smile like a doughnut! OT Supporter

    Joined:
    Sep 2, 2004
    Messages:
    2,157
    Likes Received:
    0
    Location:
    /home/sixfour
    I need a batch file that will ping computer names or ip addresses from a list inside of a .txt. I also need it to pipe the result to a different .txt whether it be true or false depending on whether or not the host was reachable.

    anyone think they can help me with this?
     
  2. crontab

    crontab Oracle doesn't have customers, they have hostages.

    Joined:
    Nov 14, 2000
    Messages:
    24,164
    Likes Received:
    210
    sounds like homework
     
  3. SixFour

    SixFour Get on your knees and smile like a doughnut! OT Supporter

    Joined:
    Sep 2, 2004
    Messages:
    2,157
    Likes Received:
    0
    Location:
    /home/sixfour
    actually i need it for work.
     
  4. samm

    samm Next in Line

    Joined:
    Dec 22, 2000
    Messages:
    2,630
    Likes Received:
    0
    Location:
    San Jose, CA
    This would take around 3 lines in perl.
     
  5. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,523
    Likes Received:
    9
    Location:
    Vancouver, BC, CANADA
    I posted my solution awhile ago but here it is again. This actually pings the server (pingserver.bat):

    Code:
    @echo off
    ping -n 1 %1 | find "Request timed out" > NUL
    if %errorlevel% equ 0 goto dead
    
    :live
    echo %1 still alive
    goto end
    
    :dead
    echo %1 dead
    
    :end
    And the other main batch file that will run thru a text file:

    Code:
    @for /f %%i in (ip.txt) do @call pingserver.bat %%i
    you can change the echo commands to:

    type %1 blah blah blah > result.txt
     
  6. crontab

    crontab Oracle doesn't have customers, they have hostages.

    Joined:
    Nov 14, 2000
    Messages:
    24,164
    Likes Received:
    210
    Time to get a new job.
     
  7. thomor25

    thomor25 I make money online....

    Joined:
    Jun 11, 2000
    Messages:
    11,101
    Likes Received:
    0
    Location:
    Denver Colorado
    I actually have a program that does this
     
  8. SixFour

    SixFour Get on your knees and smile like a doughnut! OT Supporter

    Joined:
    Sep 2, 2004
    Messages:
    2,157
    Likes Received:
    0
    Location:
    /home/sixfour
    thanks alot i appreciate it.
     

Share This Page