Link to home
Start Free TrialLog in
Avatar of gisvpn
gisvpnFlag for United States of America

asked on

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

Avatar of xassets
xassets

What about this

echo mystring >> log.txt

??
and this
date /T >> log.txt
time /T >> log.txt
Avatar of gisvpn

ASKER

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
@echo *******************>>c:\testfile.txt
time /t >>c:\testfile.txt
@echo *******************>>c:\testfile.txt
no, its

each %date% %time% string >> log.txt
ASKER CERTIFIED SOLUTION
Avatar of xassets
xassets

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yeah what xassets said :)