queries on "SET /A" to evaluate numerical expression

H

hong

I am interested in using "SET /A" from DOS to evaluate
numerical expression.

It is straightforward to return decimal equivalence of hex
number

set /a 0x45
69

and decimal equivalence of octal number

set /a 045
37

but is it possible to return hex equivalence of a decimal
number, and likewise octal equivalence of a decimal number
from "SET /A" ?

It'd be useful to have all 3 values returned from one
evaluation e.g.

set /a 32
Decimal: 32 Octal: 40 Hex: 20

set /a 040
Decimal: 32 Octal: 40 Hex: 20


Thanks

Hong
 
J

Jerold Schulman

I don't thing so.
I have a batch script to convert Decimal to Hexadecimal at tip
5842 » How do I convert a decimal number to hexadecimal?
in the 'Tips & Tricks' at http://www.jsiinc.com



I am interested in using "SET /A" from DOS to evaluate
numerical expression.

It is straightforward to return decimal equivalence of hex
number

set /a 0x45
69

and decimal equivalence of octal number

set /a 045
37

but is it possible to return hex equivalence of a decimal
number, and likewise octal equivalence of a decimal number
from "SET /A" ?

It'd be useful to have all 3 values returned from one
evaluation e.g.

set /a 32
Decimal: 32 Octal: 40 Hex: 20

set /a 040
Decimal: 32 Octal: 40 Hex: 20


Thanks

Hong


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
H

hong

hi

thanks for suggestions, which confirm my suspicion SET /A
is working on decimal-based output only (from hex or octal
input)

it's the convenience to have this command to produce other
number-based output, rather than reyling on script
function or even CALC

hong
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top