A simple way to join/unjoin files
Posted: 05 Jun 2018 01:54
There is a simple way to concatenate files by a DOS command:
An there is a way to "unconcatenate" such a Combined.bat by a DOS command: If Batch.bat consists only of lines starting with e.g. ";;==,," (this doesn't affect the execution of the bat!), the following Unjoin.bat using only the findstr command extracts the Binary.exe from the Combined.bat:
This command "ignores" all "lines" of the Combined.bat not starting with ";;==,," and outputs only the binary part. My experience is that this works perfectly, findstr extracts exactly the original Binary.exe.
Now to my question: Could findstr (or maybe antoher DOS command) be used to unjoin a file generated in such a way, with a Delimiter.txt containing only a line with ";;==,,".:
The Unjoin.bat should extract Binary1.exe, Binary2.exe, ...
Is this possible?
Thank you very much in advance.
*) Or:
The difference is: In the first example starting Combined.bat runs Batch.bat, in the second example starting Combined.exe runs Binary.exe.
And generally, of course, the file joined with Batch.bat can be any type of binary or text file.
Code: Select all
copy /a Batch.bat + /b Binary.exe /b Combined.bat *)
Code: Select all
findstr /v "^;;==,," Combined.bat > BinaryExtracted.exe
Now to my question: Could findstr (or maybe antoher DOS command) be used to unjoin a file generated in such a way, with a Delimiter.txt containing only a line with ";;==,,".:
Code: Select all
copy /b Binary1.exe + /a Delimiter.txt + /b Binary2.exe + /a Delimiter.txt + /b Binary3.exe /b Combined.exe
Is this possible?
Thank you very much in advance.
*) Or:
Code: Select all
copy /b Binary.exe + /a Batch.bat /b Combined.exe
And generally, of course, the file joined with Batch.bat can be any type of binary or text file.