Format a number to its Byte Size

#1
Converts a numeric value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size.

Code:
ver

TCC  23.00.28 x64   Windows 7 [Version 6.1.7601]
Code:
function StrFormatByteSize=`%@winapi[shlwapi.dll,StrFormatByteSize,%1,BUFFER,256]`
Code:
echo %@StrFormatByteSize[1000]
1000 bytes

echo %@StrFormatByteSize[1023]
1023 bytes

echo %@StrFormatByteSize[1024]
1.00 KB

echo %@StrFormatByteSize[10240]
10.0 KB

echo %@StrFormatByteSize[102400]
100 KB

echo %@StrFormatByteSize[1024000]
0.97 MB

echo %@StrFormatByteSize[2400000000]
2.23 GB
Joe
 
Likes: Charles G