NOTE: See How can a script determine the size of a folder, using standard commands?

Using Diruse.exe, in the public domain, because it runs much faster, I have scripted FolderSize.bat to determine the size of a folder, including all sub-folders and files.

The syntax for using FolderSize.bat is:

Call FolderSize FolderPath Size


FolderPath is the path to the folder you wish to enumerate.                              Size       is a call directed environment variable that will contain the number of bytes.
FolderSize.bat contains:
                              @echo off                              if \{%2\}==\{\} @echo Syntax: FolderSize FolderPath Size&goto :EOF                              if not exist %1 @echo Syntax: FolderSize FolderPath Size - %1 not found.&goto :EOF                              for /f "Tokens=2" %%a in ('diruse /s /b /d /q:999999999999999999999 %1^|find " TOTAL:"') do (                               set %2=%%a                              )