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. chkdsk and dir commands report different free space

    in Windows 10 Drivers and Hardware
    chkdsk and dir commands report different free space: Hello, I would like to know why is there different free space reported by chkdsk and dir commands. I created a compressed NTFS drive and have one folder with files in it. There are no errors on drive at least as reported by chkdsk: x:\>chkdsk x: The type of the...
  3. Unable to create Command Prompt output like I have done before regarding the Dir command

    in Windows 10 Software and Apps
    Unable to create Command Prompt output like I have done before regarding the Dir command: Since I am retired and enjoying my life at home with my wife, she has not one complaint with me working on my home Projects for our home. I haven't swayed away from enjoying being on this PC even here at home. I Love it!!!! This output below is what I am talking about...
  4. 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/
  5. 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...
  6. Windows 10 DIR command output format changed

    in Windows 10 Network and Sharing
    Windows 10 DIR command output format changed: Due to a recent change in windows 10 ... it seems several commands no longer recognize switches ... that is not an insurmountable problem ... BUT ... the output format of the DIR command changed the format of the output and as such ... all of my scripts that used the format...
  7. Cannot dir in My Documents folder from a command line

    in Windows 10 Network and Sharing
    Cannot dir in My Documents folder from a command line: I am the owner of My Documents, and I have Full Control. I can use Windows Explorer to navigate inside this folder, but whether I use Command Prompt or Powershell, I cannot use the dir command. Command Prompt says "File Not Found." PowerShell gives a long error message that...
  8. 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...
  9. "Mode" info returned by Windows 10 dir command

    in Windows 10 Support
    "Mode" info returned by Windows 10 dir command: Windows 10 seems to have a new set of info returned by the "dir" Powershell command. This appears under the "Mode" heading, e.g. -a---- or d----- , but nowhere have I found what these entries mean or how to interpret the individual characters. I get that they have to do with...
  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...