Solved

Batch file to add string to a TEXT file

Posted on 2004-03-24
7
946 Views
Last Modified: 2008-03-17
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

0
Comment
Question by:gisvpn
7 Comments
 
LVL 4

Expert Comment

by:xassets
Comment Utility
What about this

echo mystring >> log.txt

??
0
 
LVL 17

Expert Comment

by:mokule
Comment Utility
and this
date /T >> log.txt
time /T >> log.txt
0
 

Author Comment

by:gisvpn
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 10

Expert Comment

by:Kavar
Comment Utility
@echo *******************>>c:\testfile.txt
time /t >>c:\testfile.txt
@echo *******************>>c:\testfile.txt
0
 
LVL 4

Expert Comment

by:xassets
Comment Utility
no, its

each %date% %time% string >> log.txt
0
 
LVL 4

Accepted Solution

by:
xassets earned 500 total points
Comment Utility
oops

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

been doing too much vb obviously
0
 
LVL 10

Expert Comment

by:Kavar
Comment Utility
yeah what xassets said :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now