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.
:: 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/c
but of course you can combine the math:
set /a perc=b*100/c
And 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.