Computing.Net > Forums > Disk Operating System > Append a txt with a DOS command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Append a txt with a DOS command

Reply to Message Icon

Name: Alvaro Matos
Date: January 11, 2001 at 18:14:43 Pacific
Comment:

Can I "Append" to a created TXT file with a DOS command in Batch.

If I can, please somebody tell me how!

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: DoOMsdAY
Date: January 11, 2001 at 19:12:03 Pacific
Reply:

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 file2

Method 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 file1

One 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.


0

Response Number 2
Name: fred6008
Date: January 11, 2001 at 21:28:18 Pacific
Reply:

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.


0

Response Number 3
Name: pete warby
Date: January 12, 2001 at 02:15:06 Pacific
Reply:

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.


0

Response Number 4
Name: mr o
Date: January 12, 2001 at 02:56:29 Pacific
Reply:

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


0

Response Number 5
Name: pete warby
Date: January 12, 2001 at 06:39:08 Pacific
Reply:

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.......


0

Related Posts

See More



Response Number 6
Name: Laurence
Date: January 13, 2001 at 09:57:19 Pacific
Reply:

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#utilities

and 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 line

send ren temp mail$M$D.$Y $_exit$_|command

in the file and things will work exactly as you wish.


Batfiles: The DOS batch file programming handbook



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Append a txt with a DOS command

Resetting a modem with a dos-command www.computing.net/answers/dos/resetting-a-modem-with-a-doscommand/8240.html

Is there such a dos command? www.computing.net/answers/dos/is-there-such-a-dos-command/3251.html

Is there a Dos command to re-boot the PC? www.computing.net/answers/dos/is-there-a-dos-command-to-reboot-the-pc/2146.html