calc.vbs:
Code: Select all
wscript.echo eval(wscript.arguments(1))
and...
Code: Select all
cscript calc.vbs //nologo "2147483648^2"
Or you can split DOS's 32-bit numbers depending on what you're working with. Mileage varies with the digit you choose to split at. This is faster than the vbscript but has less range:
Code: Select all
set number=987654321
set step=000%number:~-4%
set /a low=1%step:~-4%-10000,high=%number:~,-4%+0
First you pad on one less zero than the number of digits you split at (allows for numbers lower than 1000 when splitting at 4).
Then for
low you put a one before that number truncated (to remove the excess padding) and subtract 10000. This prevents DOS from thinking it's an octal due to the leading zeros.
For
high you add +0 on the end in case
number isn't longer than 4 digits in the first place, to prevent an error.
The math from there is some simpler logic. You can accumulate large numbers simply too, by running this as a function and changing low= and high= to low+= and high+=.