Solved

Batch file to add string to a TEXT file

Posted on 2004-03-24
7
960 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
ID: 10669271
What about this

echo mystring >> log.txt

??
0
 
LVL 17

Expert Comment

by:mokule
ID: 10669554
and this
date /T >> log.txt
time /T >> log.txt
0
 

Author Comment

by:gisvpn
ID: 10670366
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 10

Expert Comment

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

Expert Comment

by:xassets
ID: 10670484
no, its

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

Accepted Solution

by:
xassets earned 500 total points
ID: 10670492
oops

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

been doing too much vb obviously
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10670939
yeah what xassets said :)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 91
groovy example issue 10 97
Windows Batch File - Display current time and date in FOR command 8 77
parse convert xml feed to text (python) 2 82
A short article about a problem I had getting the GPS LocationListener working.
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 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