Incompatibility with cmd.exe dir command

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
I'm using TCC/LE x64 13.06.

When I run the following command in a normal cmd.exe window, I get a list of just the paths that end with a directory called ".hg":

dir /s /b /a:d .hg

When I run it on TCC/LE however, I get a list of all additional subdirectories within the .hg directories too. Is this a known incompatibility? Is there a command I can use that gives me the same output as cmd.exe does (i.e. without the additional subdirectories), and is compatible with both shells?

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
If your filename does not contain any wildcards, and if it exactly matches the name of a subdirectory, then DIR assumes you want to list that subdirectory's contents and not the name of the subdirectory itself. As far as I know this is deliberate behavior, but only Rex would know for sure.

You can construct a wildspec which will only match subdirectories named .HG easily enough:

DIR /S /B /A:D .H[G]

No, this syntax is not compatible with Microsoft's shell.

(Is anyone else here having difficulty replying to posts via the rich-text editor?)