Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to write Ping Commands to output file  (Read 28952 times)

0 Members and 1 Guest are viewing this topic.

VexedFist

  • Guest
How to write Ping Commands to output file
« on: November 11, 2008, 08:01:06 AM »
Help I need to write PING and TRACERT to an output file.
However when I run my Batch file the output is on a single line

cd\

echo This is a comment >> logfile.txt
echo The date today is %date% >> logfile.txt
echo The time now is %time% >> logfile.txt
echo  >> logfile.txt
@echo off
ping 155.45.116.250 >> logfile.txt
ping xxx.xx.xxx.123 >> logfile.txt
tracert xxx.xx.xxx.123 >> logfile.txt
tracert xxx.xx.xxx.234 >> logfile.txt
tracert xxx.xx.xxx.234 >> logfile.txt
exit

Does anyone know how to do this.
Any information will be appreciated.

fireballs



    Apprentice

  • Code:Terminal
  • Thanked: 3
    Re: How to write Ping Commands to output file
    « Reply #1 on: November 11, 2008, 09:48:13 AM »
    To get a blank line use
    Code: [Select]
    echo. after each command to seperate them out.

    FB
    Next time google it.

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: How to write Ping Commands to output file
    « Reply #2 on: November 11, 2008, 11:20:12 AM »
    Code: [Select]
    cd\

    echo This is a comment >> logfile.txt
    echo The date today is %date% >> logfile.txt
    echo The time now is %time% >> logfile.txt
    echo.  >> logfile.txt
    @echo off
    ping 155.45.116.250 >> logfile.txt
    ping xxx.xx.xxx.123 >> logfile.txt
    tracert xxx.xx.xxx.123 >> logfile.txt
    tracert xxx.xx.xxx.234 >> logfile.txt
    tracert xxx.xx.xxx.234 >> logfile.txt
    exit

    There is nothing wrong with your code. As per the previous post, I added a dot to the
    echo.  >> logfile.txt line.

    Quote
    However when I run my Batch file the output is on a single line

    What are you using to view your output file? 8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein