Behavior when converting longname that's only spaces and an extension to DOS 8.3 short filename

SYLVESTRE, KYLE L 1 Reputation point
2021-08-23T14:59:18.317+00:00

I am trying to figure out what the internal behavior is when converting a long filename that is only spaces and an extension. This might be an invalid 8.3 name to begin with, but windows does some things behind the scenes to convert it to a usable short filename.

command prompt steps to replicate the condition:

  1. rename "abc.txt" " .txt"
  2. dir /x
  3. " .txt" short file entry is B6A0~1.TXT

In short, what is the algorithm for converting the long filename from step 1 (" .txt") to the 8.3 filename in step 3 ("B6A0~1.TXT")

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,370 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 39,416 Reputation points
    2021-08-23T19:38:25.64+00:00

    Hello,

    I would like to suggest below Microsoft article mentioning the same.

    https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    Thanks, Prakash

    0 comments No comments

  2. Limitless Technology 39,416 Reputation points
    2021-08-23T20:09:58.027+00:00

    Hello @SYLVESTRE, KYLE L

    All file systems follow the same general naming conventions for an individual file: a base filename and an optional extension, separated by a period. However, each file system, such as NTFS, CDFS, exFAT, UDFS, FAT, and FAT32, can have specific and different rules about the formation of individual components in the path to a directory or file.

    I would like you to check the article below that talks about what you need and the rules for this to be applied correctly:

    https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions

    If the answer was helpful, please don't forget to vote positively or accept as an answer, thank you.

    Yours sincerely,
    Samuel

    0 comments No comments