hay my friends. ;) i am just woundering, can anyone tell me is there a way to use decimal calculations in cmd (batch scripts) language?

i am writing my own program in cmd programming language, and i want to do a percent calculations (for progress bar). but cmd allways as a resoult of dividing returns full number. and i need a decimal number to be able to calculate percentage.

is there any dos utility which can be used as a patch for ms-dos 8 (windows xp cmd.exe over ntvdm.exe (or even better 32 bit dos utility without ntvdm.exe)) which can do decimal calculations?

if there is, i will install it in dos, and use it in cmd as a new command.

because cmd does not support calculations with decimal numbers (just full numbers).

thank you.

You already have one, if you have vbscript, using the EVAL function. Or, alternatively, you can just muliply the numerator by 100 before the division to get a whole number, f/e:

:: this is your raw numerator (number that have been processed, of files, sectors, etc)

set b=12

:: this is the denominator (total number of files, or sectors, or whatever)

set c=32

:: now multiply the numerator before doing the math:

set /a b*=100

:: now do the math

set /a perc=b/cbut of course you can combine the math:

set /a perc=b*100/cAnd if you want to use vbscript, here's a front-end:

http://www.computing.net/howtos/sho...Or just write your own for your specific needs.

THANK YOU, THIS HELPS. ♥

Ask Your Question

Weekly Poll

Do you think Samsung's Bixby will compete well against other phone AI systems?

Discuss in The Lounge

Poll History