i searched & tried for hours to get a newline when using a Batchfile with output -> file.
I am new to batchprograming and need some help. So here is my problem:
What i want :
I have a Batch that ping a spezific Server and writes the result in a "xml" format. This format is not real xml - its a kind of XML that a second app (LCDHost) understand. Finaly the outfile should contain :
<host>myhost2ping.com</host>
<date>22.12.2013</date>
<time>17:03:25,55</time>
<ping>36</ping>
When getting this LCDHost can read this File and show the result in a external LCD ( im my case a G19 Keyboard).
What i actually get :
<host>myhost2ping.com</host> <date>22.12.2013</date> <time>17:03:25,55</time> <ping> Minimum = 36ms</ping>
My Batch:
:begin
for /f "delims=," %%a in ('ping -n 1 myhost2ping.com') do @echo ^<host^>myhost2ping.com^</host^> ^<date^>%DATE%^</date^> ^<time^>%TIME%^</time^> ^<ping^>%%a^</ping^> > ping.txt
TIMEOUT /T 60
goto :begin
What i already tried :
all versions of & echo. set ^ as Var /n, /c/n , /r/n
What i need :
each node ... in his own line last entry should be cutted to only ms :
From Minimum = 36ms to 36.
thanky you for your help.