Change the hex value

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
space
Posts: 5
Joined: 15 Aug 2014 09:27

Change the hex value

#1 Post by space » 15 Aug 2014 09:32

Using batch script how can I change the value of the exe file without hex editor?
I need to change the value 84 to 85 in offset 000B8F40 to enable or disable one switch relay http://postimg.org/image/4z59ac2vx/


Thank you
Last edited by space on 15 Aug 2014 10:33, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Change the hex value

#2 Post by foxidrive » 15 Aug 2014 10:29

Is there only one 84 value in the file?

space
Posts: 5
Joined: 15 Aug 2014 09:27

Re: Change the hex value

#3 Post by space » 15 Aug 2014 10:31

foxidrive wrote:Is there only one 84 value in the file?

yes

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Change the hex value

#4 Post by foxidrive » 15 Aug 2014 10:45

Code: Select all

repl \x84 \x85 xm <file.bin >filenew.bin


This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.

space
Posts: 5
Joined: 15 Aug 2014 09:27

Re: Change the hex value

#5 Post by space » 15 Aug 2014 10:54

foxidrive wrote:

Code: Select all

repl \x84 \x85 xm <file.bin >filenew.bin


This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.



More easy to understand the code is there?
Thank you

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Change the hex value

#6 Post by Squashman » 15 Aug 2014 11:10

space wrote:More easy to understand the code is there?

Could you rephrase that. You have a question mark at the end of your sentence but the sentence really isn't phrased as a question.

space
Posts: 5
Joined: 15 Aug 2014 09:27

Re: Change the hex value

#7 Post by space » 15 Aug 2014 11:55

Squashman wrote:
space wrote:More easy to understand the code is there?

Could you rephrase that. You have a question mark at the end of your sentence but the sentence really isn't phrased as a question.


is there any code more easier for me to understand?

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Change the hex value

#8 Post by Squashman » 15 Aug 2014 12:03

space wrote:
Squashman wrote:
space wrote:More easy to understand the code is there?

Could you rephrase that. You have a question mark at the end of your sentence but the sentence really isn't phrased as a question.


is there any code more easier for me to understand?


What don't you understand about the code you were given?
Editing a binary file pretty much requires some type of 3rd party program. You are not going to do it with native batch file commands.

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Change the hex value

#9 Post by ShadowThief » 15 Aug 2014 14:31

What's wrong with using a hex editor?

space
Posts: 5
Joined: 15 Aug 2014 09:27

Re: Change the hex value

#10 Post by space » 15 Aug 2014 15:26

I need to automate but first I need to understand and ajust the code for my relay board. the code does more than I need.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Change the hex value

#11 Post by Squashman » 15 Aug 2014 18:27

space wrote:I need to automate but first I need to understand and ajust the code for my relay board. the code does more than I need.

Not sure what you mean. It only does one thing. It replaces the hex value in file and outputs it to a new file.

npocmaka_
Posts: 517
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Change the hex value

#12 Post by npocmaka_ » 16 Aug 2014 00:49

you can try also with certutil -> http://ss64.org/viewtopic.php?id=1562

At the moment I have no complete script that will replace your 84 value but it easy can be created with pure batch....

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Change the hex value

#13 Post by foxidrive » 16 Aug 2014 07:14

space wrote:is there any code more easier for me to understand?


I wasn't sure what you meant either - but I think you are trying to decipher how repl.bat works internally.

Use it as a tool, like findstr or sort or wmic etc, and just learn the basic syntax that you need, for now.

Post Reply