How to convert a short 8.3 path name to a long path name in PowerShell
Here is another recipe that seems to be far from obvious. I've needed to convert a path name that contained elements in the old short 8.3 format to the proper format with the long NTFS names. Turns out, it's not easy to do in .NET. There is a native call
GetLongPathName that does that but no .NET wrapper for it, so there are lots of recipes that create that wrapper for P/Invoke. And in PowerShell it becomes even more pain. But here is an easier way.
The command Get-Item gets the filesystem object, and then resolves its name afresh. So the conversion becomes easy:
$long_path = (Get-Item -LiteralPath $path).FullName