// remove following two lines // if already included uses Windows, SysUtils; function GetShortName( sLongName : string ) : string; var sShortName : string; nShortNameLen : integer; begin SetLength( sShortName, MAX_PATH ); nShortNameLen := GetShortPathName( PChar( sLongName ), PChar( sShortName ), MAX_PATH - 1 ); if( 0 = nShortNameLen )then begin // handle errors... end; SetLength( sShortName, nShortNameLen ); Result := sShortName; end;