Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can I "Append" to a created TXT file with a DOS command in Batch.
If I can, please somebody tell me how!
Thanks

What do you mean exactly. I'll show you two methods to append and let you decide if one of the two work. First you can append multiple files together. This would be done as follows. "copy file1+file2+..filen output.ext" Then you can also append text to the end of a file as well (user defined text versus a file's text). This is done as follows. "echo abunchoftext >> output.ext" So a summary of what the above actually do.
Method 1:
--------
[file1.txt]
this is some text from file1[file2.txt]
this is some text from file2"copy file1.txt+file2.txt output.txt"
[output.txt]
this is some text from file1
this is some text from file2Method 2:
--------
[file1.txt]
this is some text from file1"echo here is some more text for file1 >> file1.txt"
[file1.txt]
this is some text from file1
here is some more text for file1One more note. For the second method, you can also use one > instead of two. This will overwrite (or create if it doesn't already exist) whatever file you specify.

You can do in a batch file anything you do on the command line. I append files all the time. Say I want to tack a readme.txt file to the end of a buffer file named 1Jan.buf. The way I make the entry is TYPE README.TXT >> 1JAN>BUF. That could be a line in your batch file.

Lots of good stuff here.
Could someone tell me if this is possible:
Every night a backup txt file is created called backup.txt. I need to rename this to the date on which is was created, is there a command that will allow me to rename the file to a date value?
If anyone could help I was be very grateful.

this is easily the most popular question posted on here, and because of that i rekomend you chk out the standard answer, which is...
http://home7.inet.tele.dk/batfiles/index.htm

That is close to what I'm after, but what I need to do is actually RENAME a txt document from :
backup.log to 12jan2001 or any possible date format.
Just so long as the name contains the date in some form, that will do for what I need.
That last entry (Response Number 3) is clever, but not quite what I'm looking for. I appreciate the effort you're making though.
Please can you help me.......

My.... aren't we picky.
I suspect you want something even easier
than a batch program. It is easier with a dedicated 3rd party utility. The problem
with 3rd party utilities is:
1) Your batch programs are no longer portable. You can't just take your batch files to another computer; you must take all your extra utilities with you.2) There is overhead in keeping track of and managing these utilities (including lots of disk space), and learning and remembering how to use them.
Go here:
http://home7.inet.tele.dk/batfiles/main/download.htm#utilitiesand download send.zip .
From send.doc:
"Here is another use. Suppose that your communication program captures input into a file named "temp" by default. You want to
make a batch file which collects your electronic mail and stores it in a file whose name is stamped with today's date. Include the linesend ren temp mail$M$D.$Y $_exit$_|command
in the file and things will work exactly as you wish.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |