How to set FAT32 short names in Powershell or Windows Command Shell

1.5k Views Asked by At

I need to write a script that sets the short name of a file on a FAT32 file system. On NTFS I can use the FSUTIL utility under windows but I cannot seem to fathom out how to do this for a FAT32 drive.

Bonus kudos for a window command or powershell script

2

There are 2 best solutions below

0
On

Unfortunately it's not possible because it's the limitation of the SetFileShortName() Win32 API which I believe fsutil also uses under the hood

Sets the short name for the specified file. The file must be on an NTFS file system volume.

You can manually hex edit the FAT32 partition to set the short names and update the checksums but it'll be quite fragile without support from the file system driver

1
On

They made this super hard to get at, but here is one solution: Converting the FileSystemObject's ShortName Property