Bit of a long shot but if you don't ask....so could anyone kindly explain the process below its more the method of division and using set lookup this would help me, thanks. @echo off & setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

set LOOKUP=0123456789abcdef &set HEXSTR=&set PREFIX=

if "%1"=="" echo 0&goto :EOF

set /a A=%*

if !A! LSS 0 set /a A=0xfffffff + !A! + 1 & set PREFIX=f

:loop

set /a B=!A! %% 16 & set /a A=!A! / 16

set HEXSTR=!LOOKUP:~%B%,1!%HEXSTR%

if %A% GTR 0 goto :loop

echo %PREFIX%%HEXSTR%

set /a B=!A! %% 16Carries out a modulo operation (indicated by %%) on the value stored in environment variable A and stores the result returned in environment variable B. e.g. 31 %% 16 returns 15 (in this example the result will always be less than 16).

set /a A=!A! / 16Divides the value stored in environment variable A and stores the resulting integers (whole numbers) in an amended environment variable A e.g. 22/16 = 1.375 A will be set to 1Hope this helps.

Please come back & tell us if your problem is resolved.

Easy way to convert decimal to hex

Set LOOKUP=0123456789abcdef

Easy as pie here's how, A the number (Integer) being converted to hex needs to be divided. But it's important to remember the method of division. So lets use 26 how many times can 16 go into 26 answer is 1 times now whats remaining? 10.

So lets look both those numbers up in the LOOKUP table. We start with 1 = 1 thats the first number then 10 counting on from 0 we arrive @ A

so 26 = 1A.

Thanks to Wahine

REVISE on above if doing above 255 take note of remainder and for the divisor you have to convert to to hex example 555 / 16 = 34* r 11. 11=B now 34 /16 =2 r2 =22+B==22B==555

Ask Your Question

Weekly Poll