user1989504
user1989504

Reputation: 143

How to check programatically that 8.3 short path name is enabled on system?

I know manually we can enable or disable 8.3 short path name support by setting NtfsDisable8dot3NameCreation.

But how to read this system information through code? Actually I have to disable some functionality based on whether the system have 8.3 enabled or not.

Please help

Thanks

Upvotes: 3

Views: 8899

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174698

fsutil provides this functionality:

PS C:\Windows\system32> FSUTIL.EXE 8dot3name query D: 
The volume state is: 0 (8dot3 name creation is enabled). 
The registry state is: 2 (Per volume setting - the default).

Based on the above two settings, 8dot3 name creation is enabled on D:

If you want an API, use GetVolumeInformation, which provides this:

lpMaximumComponentLength [out, optional]

A pointer to a variable that receives the maximum length, in TCHARs, of a file name component that a specified file system supports.

A file name component is the portion of a file name between backslashes. The value that is stored in the variable that *lpMaximumComponentLength points to is used to indicate that a specified file system supports long names. For example, for a FAT file system that supports long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the NTFS file system.

Upvotes: 0

Related Questions