Windows 10: Bug in the DIR command?

Discus and support Bug in the DIR command? in Windows 10 Network and Sharing to solve the problem; Hi all. I'm running Version 10.0.17134.1365 and recently I've been testing long file names and how they're handled in an application that I work on.... Discussion in 'Windows 10 Network and Sharing' started by jmbox80pnp, Jan 12, 2021.

  1. Bug in the DIR command?


    Hi all. I'm running Version 10.0.17134.1365 and recently I've been testing long file names and how they're handled in an application that I work on. Strangely I noticed that when I try to see what the short name is for one of these files, they're not displaying correctly.


    Here's an example:

    Long name: rr6129739dkn79phk2t2hf5pggn3vn1p4x76sj6qw4366j60v14dg93hh6vgr96g64wmhd10bvtvlv7nsdpww5dkl1mw995k3pn0vr10ltv9455qrzl8kwsbprwnwz65dwgld71rxbjj26nn2c3nsv4gwmwc8c3420wcns7vg24x7k3nxrkvl43c84pb8flv78bgl74gqqt7ktf10szcckth7stjzgc9df97n9rgjzqz01234567.txt


    Short name SHOULD be: RR3560~1.TXT


    What CMD.EXE's DIR command displays:

    C:\tmp>dir /X rr6*

    01/11/2021 12:27 PM 4 RR3560~1.T rr6129739dkn79phk2t2hf5pggn3vn1p4x76sj6qw4366j60v14dg93hh6vgr96g64wmhd10bvtvlv7nsdpww5dkl1mw995k3pn0vr10ltv9455qrzl8kwsbprwnwz65dwgld71rxbjj26nn2c3nsv4gwmwc8c3420wcns7vg24x7k3nxrkvl43c84pb8flv78bgl74gqqt7ktf10szcckth7stjzgc9df97n9rgjzqz01234567.txt


    And the same incorrect short name is displayed if I instead use the /-N option


    As an alternative I find I need to use Cygwin to reliably get the short names, so the data DOES exist.

    $ find /cygdrive/c/tmp/rr6* xargs -r cygpath -d
    C:\tmp\RR3560~1.TXT


    And then if I round-trip that short name displayed by Cygwin into the DIR command again, it resolves to the correct long file name:

    C:\tmp>dir /B RR3560~1.TXT
    rr6129739dkn79phk2t2hf5pggn3vn1p4x76sj6qw4366j60v14dg93hh6vgr96g64wmhd10bvtvlv7nsdpww5dkl1mw995k3pn0vr10ltv9455qrzl8kwsbprwnwz65dwgld71rxbjj26nn2c3nsv4gwmwc8c3420wcns7vg24x7k3nxrkvl43c84pb8flv78bgl74gqqt7ktf10szcckth7stjzgc9df97n9rgjzqz01234567.txt


    Does anyone else see this error with DIR on their Win 10 machines?


    P.S. If you want to create that long file name just use Save As from Notepad.

    :)
     
    jmbox80pnp, Jan 12, 2021
    #1

  2. dir Difficulties

    I am getting the hang of this command set.

    Maybe somebody know a work around that will list the three time stamps at one time.
    Theoretically dir /TC /TA /TW.
    dir will only show one of the three at one time.

    To me it seems that the only way to get all three on a line is to run loop with output to file, then boiling down the three outputs to one line. Clumsy but maybe the only way to get the job done?

    Thanks for any suggestions.
     
    mikeincousa, Jan 12, 2021
    #2
  3. das10 Win User
    das10, Jan 12, 2021
    #3
  4. Kari Win User

    Bug in the DIR command?

    dir Difficulties

    DIR uses whatever time definition you tell it to use. Following command would list all files and folders in X:\Downloads in order they have been created:

    dir X:\Downloads /t:c


    DIR is fully capable to sort files and folders. Following command would list all files in X:\Downloads, oldest first:

    dir X:\Downloads /o:d

    The minus sign before a parameter reverses the results, so the following command would list the same folder in reversed order, newest first:

    dir X:\Downloads /o:-d

    You can also combine switches. Following command would list all files and folders in X:\Downloads and all its subfolders (the /s switch), listing them in newest first based on time of file / folder creation:

    dir X:\Downloads /s /o:-d /t:c
     
Thema:

Bug in the DIR command?

Loading...
  1. Bug in the DIR command? - Similar Threads - Bug DIR command

  2. DIR Command

    in Windows 10 Gaming
    DIR Command: dir /A:D /B /S > FolderList.txt produces a list of all directories and subdirectories of a directory. I would like to modify this line to have the date included for all directories and subdirectories of a directory too....
  3. DIR Command

    in Windows 10 Software and Apps
    DIR Command: dir /A:D /B /S > FolderList.txt produces a list of all directories and subdirectories of a directory. I would like to modify this line to have the date included for all directories and subdirectories of a directory too....
  4. Command-line shells, commands like dir /p not working but dir does work

    in Windows 10 Customization
    Command-line shells, commands like dir /p not working but dir does work: I am using W'10, Administrative Windows Power Shell, command line.When I do a "DIR" it works, but when I add parameters, I get this error message:-----------------PS C:\> dir /sdir : Cannot find path 'C:\s' because it does not exist.At line:1 char:1+ dir /s+ ~~~~~~ +...
  5. Command-line shells, commands like dir /p not working but dir does work

    in Windows 10 Gaming
    Command-line shells, commands like dir /p not working but dir does work: I am using W'10, Administrative Windows Power Shell, command line.When I do a "DIR" it works, but when I add parameters, I get this error message:-----------------PS C:\> dir /sdir : Cannot find path 'C:\s' because it does not exist.At line:1 char:1+ dir /s+ ~~~~~~ +...
  6. Command-line shells, commands like dir /p not working but dir does work

    in Windows 10 Software and Apps
    Command-line shells, commands like dir /p not working but dir does work: I am using W'10, Administrative Windows Power Shell, command line.When I do a "DIR" it works, but when I add parameters, I get this error message:-----------------PS C:\> dir /sdir : Cannot find path 'C:\s' because it does not exist.At line:1 char:1+ dir /s+ ~~~~~~ +...
  7. DIR commands

    in Windows 10 Ask Insider
    DIR commands: So recently I used the DIR commands to be able to see hidden and Invisible files, is there any way to revert this? submitted by /u/Creeper_King_558 [link] [comments] https://www.reddit.com/r/Windows10/comments/inyfq2/dir_commands/
  8. DOS Dir Command issues-dir *. /s doesn't get all subfolders?

    in Windows 10 Software and Apps
    DOS Dir Command issues-dir *. /s doesn't get all subfolders?: I am trying to get an accurate picture of my music library, where all music is stored in album subfolders under artist folders. I opened a CMD window and at "E:\My Music\" prompt, typed: "dir *. /s" >dir.txt" in order to generate a text file of all folders and subfolders...
  9. Dir command gives unexpected / unwanted results

    in Windows 10 Support
    Dir command gives unexpected / unwanted results: If I open a command prompt window and give the command " dir *.xls", I also get all xlsm, xlsx, xlsq etc files. This behaviour is unwanted and illogical. it makes scripting hopelessly complex and unreliable. If I wanted those files, I would issue a "dir *.xls?" command. For...
  10. Hidden char in file name showed by command dir

    in Windows 10 Support
    Hidden char in file name showed by command dir: Hi, In tracking a bug in app, I discovered something very odd. I have a strange file name in a directory. If I do a dir command the file name appearing is not the same as with Win Explorer! Even the copy paste from the console removes the extra char. Attached...