Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I need to create a batch file that will copy two text files from a server drive and append them to a history text file. I think I need to use the COPY command with + to append a file, but I just can't get it to work. Can anyone tell me exactly what the syntax should be? The two files that need to be copied are called 'adlabels.txt' and 'aclabels.txt', and the history file is called 'labels.hst'. The two text files are basically print jobs, which are deleted once they are completed. New files are then generated for the next print job with the same names - these two new files would then also need to be added to the history file, which I am hoping the batch file will do.
Thanks.

The COPY command will refuse to copy a program on top of itself, so there needs to be some amount of re-naming. I have not tested the following, but it should work.
cd x:\xxxx\xxxx (change to directory)
rename labels.hst labels.$$$
copy labels.$$$+adlabels.txt+aclabels.txt labels.hst

Hi,
Instead of using "copy" try "type".example:
cls
@echo off
type adlabels.txt >>label.hst
type aclabel.txt >>label.hstNote: 1 > will overwrite.
2 >> appends....addsTo use copy and type
copy adlabels.txt + aclabels.txt label.txt
type label.txt >>label.hst
*************snip and paste***********
cls
@echo off
copy adlabels.txt + aclabels.txt label.txt
type label.txt >>label.hst
:end
clsHope this is of help. The copy command is not always the best way to copy.......hmmmm.
Peace Goodwill and Happy Computing
World Library

Many thanks to the both of you for the help - I now have a working batch file that does exactly what I want!

![]() |
Download DOS 6.2
|
Compaq laptop
|

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