I want to get the size of directory say C:\\Temp in MB using batch file. I don\'t need sizes of child directories or files, but the size of directo
if you need exact values, go for another option. But if you need a rough value only (cut, not rounded, not 1024 as divisor but 1000 only):
@echo off
for /f "tokens=2 delims=," %%a in ('dir *^|findstr /e "Bytes"') do (
for /f "delims= " %%i in ("%%a") do set size=%%i
)
echo size in Bytes: %size%
echo that's about %size:~0,-4% KB
echo or about %size:~0,-8% MB
echo or about %size:~0,-12% GB
Advantage: this is string manipulation only, no math included, so it even works outside 32bit Integer (which would be limited to sizes up to about 2GB).