Command Line Text File Appending

I'm trying to generate a log file (text file) that is appended to every time I run a batch file. It will enable me to see a history of my network problems. I have two questions:

1) How can I get the date and time to append on one line of the text file. I am currently using

date /t >> output.txt & time /t >> output.txt

That works, but displays the information on two separate lines. Is there an option other than date /t or time /t?

2) How do I append a string of text to the output.txt file? I thought it would be something like:

"Everything is fine" >> output.txt

but that doesn't work. Any ideas?

Thanks
4 answers Last reply
More about command line text file appending
  1. 1) Try net time \\%computername% |find "Current time" >> output.txt

    2) Try echo Everything is fine >> output.txt

    8)
  2. Works like a charm. Thanks. :D
  3. Glad to help 8)
  4. crazyhandpuppet said:
    I'm trying to generate a log file (text file) that is appended to every time I run a batch file. It will enable me to see a history of my network problems. I have two questions:

    1) How can I get the date and time to append on one line of the text file. I am currently using

    date /t >> output.txt & time /t >> output.txt

    That works, but displays the information on two separate lines. Is there an option other than date /t or time /t?

    2) How do I append a string of text to the output.txt file? I thought it would be something like:

    "Everything is fine" >> output.txt

    but that doesn't work. Any ideas?

    Thanks



    Echo "%date% %time% Everything is fine"
Ask a new question

Read More

Displays Command Line Windows XP