<p>I need to join two binary files with a <code>*.bat</code> script on Windows.</p>

<p>How can I achieve that?</p>

[{'answer_id': 60248, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 7, 'selected': False, 'text': '<p>You can use <code>copy /b</code> like this:</p>\n\n<pre><code>copy /b file1+file2 destfile\n</code></pre>\n'}, {'answer_id': 60249, 'author': 'simon', 'author_id': 6040, 'author_profile': 'https://Stackoverflow.com/users/6040', 'pm_score': 3, 'selected': False, 'text': '<p>Just use the dos copy command with multiple source files and one destination file.</p>\n\n<pre class="lang-sh prettyprint-override"><code>copy file1+file2 appendedfile\n</code></pre>\n\n<p>You might need the /B option for binary files</p>\n'}, {'answer_id': 60254, 'author': 'Nathan Jones', 'author_id': 5848, 'author_profile': 'https://Stackoverflow.com/users/5848', 'pm_score': 10, 'selected': True, 'text': '<p>Windows <code>type</code> command works similarly to UNIX <code>cat</code>.</p>\n\n<p><strong>Example 1:</strong></p>\n\n<pre><code>type file1 file2 &gt; file3\n</code></pre>\n\n<p>is equivalent of:</p>\n\n<pre><code>cat file1 file2 &gt; file3\n</code></pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre><code>type  *.vcf &gt; all_in_one.vcf  \n</code></pre>\n\n<p>This command will merge all the vcards into one.</p>\n'}, {'answer_id': 60257, 'author': 'Jay Bazuzi', 'author_id': 5314, 'author_profile': 'https://Stackoverflow.com/users/5314', 'pm_score': 4, 'selected': False, 'text': '<p>Shameless PowerShell plug (because I think the learning curve is a pain, so teaching something at any opportunity can help)</p>\n\n<pre><code>Get-Content file1,file2\n</code></pre>\n\n<p>Note that <code>type</code> is an alias for Get-Content, so if you like it better, you can write:</p>\n\n<pre><code>type file1,file2\n</code></pre>\n'}, {'answer_id': 60313, 'author': 'David Citron', 'author_id': 5309, 'author_profile': 'https://Stackoverflow.com/users/5309', 'pm_score': 5, 'selected': False, 'text': '<p>If you have control over the machine where you\'re doing your work, I highly recommend installing <a href="http://gnuwin32.sourceforge.net/" rel="noreferrer">GnuWin32</a>. Just "Download All" and let the wget program retrieve all the packages. You will then have access to cat, grep, find, gzip, tar, less, and hundreds of others.</p>\n\n<p>GnuWin32 is one of the first things I install on a new Windows box.</p>\n'}, {'answer_id': 23946721, 'author': 'Jahmic', 'author_id': 573927, 'author_profile': 'https://Stackoverflow.com/users/573927', 'pm_score': 1, 'selected': False, 'text': '<p>If you simply want to append text to the end of existing file, you can use the >> pipe. ex:</p>\n\n<pre><code>echo new text &gt;&gt;existingFile.txt\n</code></pre>\n'}, {'answer_id': 26384080, 'author': 'Noelkd', 'author_id': 1663352, 'author_profile': 'https://Stackoverflow.com/users/1663352', 'pm_score': 0, 'selected': False, 'text': '<p>If you have to use a batch script and have python installed here is a <a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29" rel="nofollow noreferrer">polyglot</a> answer in batch and python:</p>\n<pre><code>1&gt;2# : ^\n\'\'\'\n@echo off\npython &quot;%~nx0&quot; &quot; %~nx1&quot; &quot;%~nx2&quot; &quot;%~nx3&quot;\nexit /b\nrem ^\n\'\'\'\nimport sys\nimport os\n\nsys.argv = [argv.strip() for argv in sys.argv]\nif len(sys.argv) != 4:\n    sys.exit(1)\n\n_, file_one, file_two, out_file = sys.argv\n\nfor file_name in [file_one, file_two]:\n    if not os.path.isfile(file_name):\n        print &quot;Can\'t find: {0}&quot;.format(file_name)\n        sys.exit(1)\n\nif os.path.isfile(out_file):\n    print &quot;Output file exists and will be overwritten&quot;\n\nwith open(out_file, &quot;wb&quot;) as out:\n    with open(file_one, &quot;rb&quot;) as f1:\n        out.write(f1.read())\n\n    with open(file_two, &quot;rb&quot;) as f2:\n        out.write(f2.read())\n</code></pre>\n<p>If saved as join.bat usage would be:</p>\n<pre><code>join.bat file_one.bin file_two.bin out_file.bin\n</code></pre>\n<p>Thanks too <a href="https://stackoverflow.com/a/17468811/1663352">this answer</a> for the inspiration.</p>\n'}, {'answer_id': 37285468, 'author': 'sam msft', 'author_id': 640259, 'author_profile': 'https://Stackoverflow.com/users/640259', 'pm_score': 2, 'selected': False, 'text': "<p>In Windows 10's Redstone 1 release, the Windows added a real Linux subsystem for the NTOS kernel.  I think originally it was intended to support Android apps, and maybe docker type scenarios.  Microsoft partnered with Canonical and added an actual native bash shell.  Also, you can use the apt package manager to get many Ubuntu packages.  For example, you can do apt-get gcc to install the GCC tool chain as you would on a Linux box.</p>\n\n<p>If such a thing existed while I was in university, I think I could have done most of my Unix programming assignments in the native Windows bash shell.</p>\n"}, {'answer_id': 53236194, 'author': 'Aaron Xu', 'author_id': 10631886, 'author_profile': 'https://Stackoverflow.com/users/10631886', 'pm_score': 0, 'selected': False, 'text': '<p>I try to rejoin tar archive which has been splitted in a Linux server.</p>\n\n<p>And I found if I use <code>type</code> in Windows\'s <code>cmd.exe</code>, it will causes the file being joined in wrong order.(i.e. <code>type</code> sometimes will puts XXXX.ad at first and then XXXX.ac , XXXX.aa etc ...)</p>\n\n<p>So, I found a tool named <code>bat</code> in GitHub <a href="https://github.com/sharkdp/bat" rel="nofollow noreferrer">https://github.com/sharkdp/bat</a> which has a Windows build, and has better code highlight and the important thing is, it works fine on Windows to rejoin tar archive!</p>\n'}, {'answer_id': 54167784, 'author': 'Ricky Divjakovski', 'author_id': 2884140, 'author_profile': 'https://Stackoverflow.com/users/2884140', 'pm_score': 1, 'selected': False, 'text': '<p>So i was looking for a similar solution with the abillity to preserve EOL chars and found out there was no way, so i do what i do best and made my own utillity\nThis is a native cat executable for windows - <a href="https://mega.nz/#!6AVgwQhL!qJ1sxx-tLtpBkPIUx__iQDGKAIfmb21GHLFerhNoaWk" rel="nofollow noreferrer">https://mega.nz/#!6AVgwQhL!qJ1sxx-tLtpBkPIUx__iQDGKAIfmb21GHLFerhNoaWk</a></p>\n\n<pre><code>Usage: cat file1 file2 file3 file4 -o output.txt\n-o | Specifies the next arg is the output, we must use this rather than "&gt;&gt;" to preserve the line endings\n</code></pre>\n\n<p>I call it sharp-cat as its built with C#, feel free to scan with an antivirus and source code will be made available at request</p>\n'}, {'answer_id': 61777615, 'author': 'user42391', 'author_id': 13534511, 'author_profile': 'https://Stackoverflow.com/users/13534511', 'pm_score': 0, 'selected': False, 'text': "<p>Windows type command has problems, for example with Unicode characters on 512 bytes boundary. Try Cygwin's cat.</p>\n"}]
['https://Stackoverflow.com/questions/60244', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2313/']