14

I have created a split file on a Linux system as indicated in this Unix.SE question. However, when I copy that file to a Windows system, I cannot recreate the original file. Using 7-zip gives me an error about it being unable to detect the file as a splitted file, and using copy first-file + second-file output-file gives me a 50kb output instead of the correct 7GB output.

What is the correct way to combine two files on Windows?

Macha
  • 5,282
  • 16
  • 63
  • 92
  • http://superuser.com/questions/111825/any-command-line-or-batch-cmd-to-concatenate-multiple-files – Yasen Nov 04 '13 at 16:15

3 Answers3

28

Add the /b parameter to indicate it's binary:

copy /b example1.ext + example2.ext example.ext
Tamara Wijsman
  • 57,083
  • 27
  • 185
  • 256
  • seems to work, though the copy /? documentation seems it might suggest a /B after each file like in bui's answer, but indeed it seems you only need the one /B after copy. As you've done. – barlop May 20 '16 at 08:38
2

I've used HJSplit in the past with remarkable success. It's pretty straight-forward and simple to use, and it helps avoid typos on the command line (although the command line works just as well)

0
set n=2
for /l %i in (1,1,%n%) do type file%i.ext >> file.out

Works on both text & binary files.
Tested on Win 10 CMD.

Zimba
  • 1,051
  • 11
  • 15