My implementation is slightly different:
select
extract_token(path,add(1,strcnt('%CD%','\\')),'\\') as dir,
sum(size) as sumsize
from
'%CD%\*'
where
Name not in ('.';'..')
group by
dir
order by
sumsize
desc
Note, if you save it as a file you have to call it like:
logparser -i:fs file:getdiskspace.sql?CD=%CD%
(%CD% isn't a real environment variable - so Log Parser can't find it)