|
Answer» Hi all,
I need to create Hex files using a batch file.
I've got this part of the code working for when I need simple text to be exported to a Hex file:
Code: [Select]CMD /U /C echo this is a test>>hex.txt But the problem is that I also need to be able to write stuff directly in the hex section of the file. Using CMD /U only converts text to unicode, so adding a blank spot between EVERY letter, but I also need to add NUMBERS and values directly in the hex section of the code.
For example, I would need to add the number 76 before the word "animal"
If I simply echo "76animal" it will export as: .7.6.a.n.i.m.a.l 00 37 00 36 61 00 6e 00 69 00 6d 00 61 00 6c But what I would need is actually: .La.n.i.m.a.l 00 4c 61 00 6e 00 69 00 6d 00 61 00 6c
Does anyone know if that would be possible?Seems to me that what you've shown is the hex display of a binary file. Binary files are usually displayed in hex notation to make them more human friendly so that instead of displaying 01001100 the display shows hex 4C which can be interpreted as the letter L. To ALTER the binary file content you need a PROGRAM to write binary values, afaik not available in the Command Interpreter.
You could look at using Debug or a suitable programming language.
Good luckOP, if you download GNU tools ( see my sig ), you can use od command
Code: [Select]C:\test>echo "sfsfdfsg" | od -x 0000000 7322 7366 6466 7366 2267 0d20 000a 0000015
|