Of course it will return null if path is deeper. A directory does not have a label, only a drive does.
You may use this:
Code:
var %path = c:\windows
noop $regex(%path,/^([a-z]:(?:\\|\/))/i)
var %drive = $regml(1)
echo 4 -a Label name of driver that has the folder %path is: $disk(%drive).label

If you wanted to get 'windows' from c:\windows, this is not the label, this is the folder name.
You may use this:
Code:
var %path = c:\windows
if ($right(%path,1) == \) var %tpath = $nopath($left(%path,-1))
else var %tpath = $nopath(%path)
echo 4 -a %path => %tpath