# DOS 8.3 short paths via PowerShell

G5th July 2016

Use this PowerShell script to discover the DOS 8.3 path name for any selected folder in Windows.

Sometimes in programming, there is a need to return the short path name of a folder. The following PowerShell script will return the short path name of a selected directory in Windows.

In PowerShell, simply cd to the directory that you wish to derive the DOS 8.3 path name for, then use the following code:

New-Item 0.txt -type file | Out-Null #Creates 0.txt

$path = (dir 0.txt).FullName #Returns full path name of file$object = New-Object -ComObject Scripting.FileSystemObject
$output =$object.GetFile($path)$output.shortpath.trim("0.txt") | Out-Null #Generates 8.3 short file path output

﻿