| View previous topic :: View next topic |
| Author |
Message |
ezuk
Joined: 04 Jun 2005 Posts: 146
|
Posted: Wed Jan 21, 2009 6:14 pm Post subject: binary merge? |
|
|
Hi everyone,
I'm trying to merge a couple of binary files.
For now, I'm doing it using the COPY command (console), but it's an ugly hack, and I actually want to distribute this utility.
Any clever ideas of how to do it smoothly, without using the Run command? |
|
| Back to top |
|
 |
BoBoł Guest
|
Posted: Wed Jan 21, 2009 7:19 pm Post subject: |
|
|
| Just use the Run command with its Hide parameter. |
|
| Back to top |
|
 |
ezuk as guest Guest
|
Posted: Thu Jan 22, 2009 8:13 am Post subject: |
|
|
| BoBoł wrote: | | Just use the Run command with its Hide parameter. |
But I'm afraid it won't always work on every computer.
No reason for me to be? |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Thu Jan 22, 2009 8:56 am Post subject: |
|
|
| How large are the binary files? |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 22, 2009 9:35 am Post subject: |
|
|
| ezuk as guest wrote: | | BoBoł wrote: | | Just use the Run command with its Hide parameter. |
But I'm afraid it won't always work on every computer.
No reason for me to be? |
It will work on any computer that AHK will work on. Hide is a function of AHK.
| Code: | #SingleInstance, force
binfile1 = "e:\any dir\WIN95.PIF"
binfile2 = "e:\any dir\WIN952.PIF"
mergedfile = "%A_Temp%\outfile.bin"
Run, %comspec% /c copy /y /b %binfile1% + %binfile2% %mergedfile%, , hide
ExitApp |
|
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Thu Jan 22, 2009 9:36 am Post subject: |
|
|
| Anonymous wrote: | | It will work on any computer that AHK will work on. Hide is a function of AHK. |
Hide parameter never worked for me in Windows 98 .. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 22, 2009 11:18 am Post subject: |
|
|
| SKAN wrote: | | Anonymous wrote: | | It will work on any computer that AHK will work on. Hide is a function of AHK. |
Hide parameter never worked for me in Windows 98 .. |
That is funny, I tested on a win98se box and it works just fine. (and if there is an OS limitation, I would expect to see it in the help file).  |
|
| Back to top |
|
 |
BoBoł Guest
|
Posted: Thu Jan 22, 2009 12:21 pm Post subject: |
|
|
| Quote: | | COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] | means that to me (which I use to merge a sliced mpeg video stream): | Code: | | COPY /B source /B + source /B + ... destination |
No idea why this should work out fine | Code: | | COPY /B source + source + ... destination |  |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Jan 22, 2009 12:34 pm Post subject: |
|
|
| BoBoł wrote: | | Quote: | | COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] | means that to me (which I use to merge a sliced mpeg video stream): | Code: | | COPY /B source /B + source /B + ... destination |
No idea why this should work out fine | Code: | | COPY /B source + source + ... destination |  |
| MSDOS 6.22 help file wrote: | /A
Indicates an ASCII text file. When the /A switch precedes the list of
filenames on the command line, it applies to all files whose names
follow the /A switch, until COPY encounters a /B switch, in which case
the /B switch applies to the file whose name precedes the /B switch.
When the /A switch follows a filename, it applies to the file whose name
precedes the /A switch and to all files whose names follow the /A
switch, until COPY encounters a /B switch, in which case the /B switch
applies to the file whose name precedes the /B switch.
An ASCII text file can use an end-of-file character (CTRL+Z) to indicate
the end of the file. When combining files, COPY treats files as ASCII
text files by default.
/B
Indicates a binary file. When the /B switch precedes the list of
filenames on the command line, it applies to all files whose names
follow the /B switch, until COPY encounters an /A switch, in which case
the /A switch applies to the file whose name precedes the /A switch.
When the /B switch follows a filename, it applies to the file whose name
precedes the /B switch and to all files whose names follow the /B
switch, until COPY encounters an /A switch, in which case the /A switch
applies to the file whose name precedes the /A switch.
The /B switch specifies that the command interpreter is to read the
number of bytes specified by the file size in the directory. The /B
switch is the default value for COPY unless COPY is combining files.
|
|
|
| Back to top |
|
 |
BoBoł Guest
|
Posted: Thu Jan 22, 2009 12:56 pm Post subject: |
|
|
Thanks. I didn't have that "prehistoric description" at hand, so this makes sense to me now.  |
|
| Back to top |
|
 |
degarb
Joined: 14 Feb 2007 Posts: 307
|
Posted: Tue Jan 27, 2009 6:47 pm Post subject: |
|
|
The only thing I see missing is destination needs to exist in my experience. I would take some file delete all out of it except a byte, save.
Or is there a switch to avoid the need to create the destination file before merging to it? |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Tue Jan 27, 2009 6:52 pm Post subject: |
|
|
| degarb wrote: | | I would take some file delete all out of it except a byte, save. |
| Code: | | FileAppend,,degarb.mp3 ; will create a zerobyte file |
_________________ URLGet - Internet Explorer based Downloader |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Jan 28, 2009 3:40 am Post subject: |
|
|
| degarb wrote: | The only thing I see missing is destination needs to exist in my experience. I would take some file delete all out of it except a byte, save.
Or is there a switch to avoid the need to create the destination file before merging to it? |
Read the cmd.exe help (cmd.exe /?).
| Quote: | | COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] |
which means that the output file will be created if it does not exist, and the /y means that the output file will be overwritten if it does exist.
This creates (or overwrites) newfile.bin.
| Code: | | copy /b /y file1.bin + file2.bin newfile.bin |
|
|
| Back to top |
|
 |
|