Solved

Batch file to add string to a TEXT file

Posted on 2004-03-24
7
964 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.

808 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