Batch file to add string to a TEXT file

Hello i would like a batch file which when run will insert a little bit of text and the current time and date..

If possible i would like this to append to any other text already in the text file and have a break on each insert of text.

The name of the text file is log.txt

Many thanks

Ollie

gisvpnAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
xassetsConnect With a Mentor Commented:
oops

echo %date% %time% string >> log.txt

been doing too much vb obviously
0
 
xassetsCommented:
What about this

echo mystring >> log.txt

??
0
 
mokuleCommented:
and this
date /T >> log.txt
time /T >> log.txt
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
gisvpnAuthor Commented:
Thanks,

I have used the following in a single batch file.

date /T >> log.txt
time /T >> log.txt
echo MS04-007 >> log.txt
echo -END- >> log.txt


The output in the file is

Wed 24/03/2004
18:41
MS04-007
-END-

Can i get this all on one line ?????

Thanks
0
 
KavarCommented:
@echo *******************>>c:\testfile.txt
time /t >>c:\testfile.txt
@echo *******************>>c:\testfile.txt
0
 
xassetsCommented:
no, its

each %date% %time% string >> log.txt
0
 
KavarCommented:
yeah what xassets said :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.