Script file (8dot3name.ps1) with implementation(s) on getting af short (8.3) name on a given Directory or File. The result is similar to what is given by dir /x.
-
Add-Typecan only add type once in a .NET AppDomain, that is in reality like a PowerShell session. It is not possible to programmatically remove custom type.
Investigate ifAdd-Typecan be avoided. - Function should take input on either
DirectoryInfoorFileInfotype. Look into overload possibilities. Maybe using custom PowerShell class. OrParameterSetName. - Validate parameter value; does object exist.
Microsoft Docs: GetShortPathNameW function (fileapi.h)
Idera Community: Converting File Paths to 8.3 (Part 2)