Jump to content
Sign in to follow this  
AcidCorps

Merge Files

Recommended Posts

AcidCorps

I'm looking for a way to copy multiple files into one (not an archive) like you can do through CMD using the following command:

Copy /b File.ext File2.ext Comb.ext

I tried using FileCopy('File.ext' + File2.ext', 'Comb.ext')

I tried FileRead then combining the strings then writing a new file

neither of these worked

what I'm using to test it is a 7z SFX where you combine the archive with a config file and the SFX file:

copy /b 7zs.sfx + config.txt + Archive.7z Installer.exe

but with the two attempts i've made through autoit I get an unusable EXE

I'd like to be able to do this without using @ComSpec or CMD if possible since but if I need to I can do it that way I was just hoping someone else would have another way

- Acid Corps

Share this post


Link to post
Share on other sites
weaponx

Merging any files into an exe will result in an invalid executable unless the files are pieces of a split exe.

Share this post


Link to post
Share on other sites
AcidCorps

when i do it with the cmd code i pasted it works perfectly fine as a sfx

Share this post


Link to post
Share on other sites
Skruge

I tried FileRead then combining the strings then writing a new file

Make sure you're opening the files in binary mode.

Func _FileMerge($s_SrcFile1, $s_SrcFile2, $s_DestFile)
    ; Read Files in Binary Mode
    Local $h_File1 = FileOpen($s_SrcFile1 , 16)
    Local $h_File2 = FileOpen($s_SrcFile2 , 16)
    FileWrite($s_DestFile, FileRead($h_File1) & FileRead($h_File2))
EndFunc

Tested with split.exe. (http://unxutils.sourceforge.net/)


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×