1.

Solve : How to write Ping Commands to output file?

Answer»

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.
To get a BLANK line use Code: [SELECT]echo. after each command to seperate them out.

FB 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?


Discussion

No Comment Found