question

SYLVESTREKYLEL-3694 avatar image
0 Votes"
SYLVESTREKYLEL-3694 asked Reza-Ameri commented

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

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
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Did you observe this behavior in other version of Windows?

0 Votes 0 ·

Was able to replicate on windows 7 and 10

0 Votes 0 ·
Reza-Ameri avatar image Reza-Ameri SYLVESTREKYLEL-3694 ·

Do you have any idea to improve this behavior?
Are you observing any abnormal behavior?

0 Votes 0 ·
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello,


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

https://docs.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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @SYLVESTREKYLEL-3694


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://docs.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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.