Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The "Copy /b" command on cmd

7,381 views
Skip to first unread message

Becquer

unread,
Jun 1, 2008, 3:01:00 PM6/1/08
to
I can merge two files by typing on the cmd(without the [] and the "") :

"copy /b [file1name] + [file2name] [targetfilename]"

Where [file1name] and [file2name] are the name of the two files I want to
merge and [targetfilename] is the result file where i want they to mergre in.

But, how can I "unmerge" the result file into the original files?

Pegasus (MVP)

unread,
Jun 1, 2008, 3:24:31 PM6/1/08
to

"Becquer" <Bec...@discussions.microsoft.com> wrote in message
news:8EC4D24C-8F75-4C9C...@microsoft.com...

The two (or more) files are merged seamlessly. Unless you add
a marker (see below), you cannot unmerge them.

echo ================== > marker.txt
copy /b file1.txt + marker.txt + file2.txt file3.txt


HeyBub

unread,
Jun 1, 2008, 5:14:51 PM6/1/08
to

Slight correction: the files are not "merged." They are "concatenated."

The "/b" switch implies the files are binary files, NOT text files, that
they should be copied in their entirety rather than the copy process
quitting at the first end-of-file marker.


Alan

unread,
Jun 1, 2008, 6:27:35 PM6/1/08
to
Hi Becquer,

If I wanted the ability to go back to each separate file, I would make a
copy of each file before concatenating to the target file.

Alan

"Becquer" <Bec...@discussions.microsoft.com> wrote in message
news:8EC4D24C-8F75-4C9C...@microsoft.com...

Patrick Keenan

unread,
Jun 1, 2008, 7:41:15 PM6/1/08
to
"Becquer" <Bec...@discussions.microsoft.com> wrote in message
news:8EC4D24C-8F75-4C9C...@microsoft.com...
>I can merge two files by typing on the cmd(without the [] and the "") :
>
> "copy /b [file1name] + [file2name] [targetfilename]"
>
> Where [file1name] and [file2name] are the name of the two files I want to
> merge and [targetfilename] is the result file where i want they to mergre
> in.

As noted, this concatenates, not merges. There can be a difference.

> But, how can I "unmerge" the result file into the original files?

You can't, using these utilities. And the original files still exist.

If you want to split files, use a file split utility. If you want to
reproduce the original sizes, you have to know exactly where the
concatenation occurred and specify that for the split.

HTH
-pk

rliuhtfc

unread,
Sep 27, 2011, 8:23:19 AM9/27/11
to
Do you know any programs that allow you to split a file at given offset?


rliuhtfc

unread,
Sep 27, 2011, 8:19:00 AM9/27/11
to
Then what? How do you split by the marker? In other words, how to you
seek for the marker?


rliuhtfc

unread,
Sep 27, 2011, 8:31:41 AM9/27/11
to
Alan,

There are cases that you want to ship users a combined file and tell
them how to split the original files back. For example, I want to ship a
user a combined file of a exe and an zip file (combined by copy /b). I
want the user be able to split the file back the exe and the zip.

Apparently, Windows provided a tool to combine files but did not provide
a tool to reverse the combination back to the originals that are in need
in real life.


rliuhtfc

unread,
Sep 27, 2011, 8:35:10 AM9/27/11
to
I have exactly the same need. Have you found a way to split the combined
file back to the originals?

That is:

when someone combined two file1 and file2 by using

Copy /b file1+file2 file3

I need something like:

Split /b file3 file1 file2

to reverse the original file1 and file2 back. Windows provided a way in
(Copy /b) but did not provide a way out.

I understand this is an old thread but I do not see a answer or solution
to your question.


0 new messages