Sign in with
Sign up | Sign in
Your question

Command Line Text File Appending

Last response: in Windows XP
Share
March 29, 2007 1:28:00 PM

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
March 29, 2007 3:20:11 PM

1) Try net time \\%computername% |find "Current time" >> output.txt

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

8)
Related resources
March 29, 2007 4:15:21 PM

Glad to help 8)
June 28, 2012 11:23:02 AM

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"
!