@DDEPTH — Returns the depth of a file or subdirectory.

Syntax:
@DDEPTH[file]

filedirectory aliases and relative paths are okay

Returns 0 for items in the root directory, 1 for items in a subdirectory, 2 for items in a sub-subdirectory, and so on. File need not actually exist.

echo %@ddepth[c:\foo\bar\readme.txt]