Sign in with
Sign up | Sign in

Command Line Text File Appending

Last response: in Windows XP
Share

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

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 the community
!