How can I prepend a byte to the beginning of a binary file in windows?

2

I have a binary file and I want to add a specific byte to the beginning of this file. How can I do it?

Sunny88

Posted 2013-11-20T19:27:06.190

Reputation: 325

Question was closed 2013-11-21T04:51:58.377

2use a hex editor – Ramhound – 2013-11-20T19:29:30.867

2Hi, can you please indicate what type of technology you are interested in using to accomplish this? A programming language? If so, which one? How about a command shell? Again, if so, which one? Are you looking for a specific pre-packaged program? With a GUI, or on the console? Etc. This question is so broad with so many possible answers that we have to narrow it down somewhat, or it'll be closed as too broad. – allquixotic – 2013-11-20T19:29:35.323

@allquixotic Ideally I would like to be able to do it from cmd.exe with some kind of utility. – Sunny88 – 2013-11-20T19:33:46.483

2copy OneByteFile.bin+FileToPrepend.bin NewFile.bin? – Ƭᴇcʜιᴇ007 – 2013-11-20T19:42:38.337

@techie007 How can I create the OneByteFile.bin ? Say I want it to contain the byte 0x4d. – Sunny88 – 2013-11-20T19:46:15.260

How are you currently accomplishing this task? If you're not, then to round out the question/answers into a bigger picture, WHY do you want to do this? – Ƭᴇcʜιᴇ007 – 2013-11-20T19:50:04.427

@techie007 I have an exe file which was downloaded incorrectly, starting from the second byte. So the file is complete except that it misses the very first byte. I know that all exe files must start with the byte 0x4d, so I want to recover the file by adding this byte to the beginning of it. I was just able to do it using a hex editor as per Ramhound's comment. I couldn' prepend the byte using hex editor, but I could create a new file with it, and then join these two files using "copy /b". – Sunny88 – 2013-11-20T20:01:25.690

No answers