Dealing withLong file names in DOS
Thread Starter
Sellby_date Expired
Joined: Jan 2003
Posts: 169
Likes: 0
From: East Anglia
Dealing withLong file names in DOS
As a result of something occurring this week (See Burning DVD thread) I need to get into a file in Program Files whilst poking about in DOS.
The problem is, how do I do CD Program Files, as the break is not recognised by the cd command...
This goes of course for any double barrelled file name.
HELP.
The problem is, how do I do CD Program Files, as the break is not recognised by the cd command...
This goes of course for any double barrelled file name.
HELP.
Joined: Oct 2006
Posts: 103
Likes: 0
From: EGBJ Gloucester
Older Windows and DOSs limited filenames to 8 characters, dot, 3 characters - which is known as 8.3 format for obvious reasons. Spaces are not allowed.
Since Windows 95/98 (can't remember which) Windows now uses long filenames (LFN) which can be up to 256 characters and any dots are your own decision.
To convert a LFN to 8.3 format, take the first 6 characters ignoring spaces
and add ~N onto it - where N is usually 1. If there are multiple files in a folder with the same 6 characters prefix, N increments for each of them in alphabetical order. If it is a file, not a folder, you can then append the .xxx extension.
So, "C
Program Files" would become "C
Progra~1"
If there was also "C
Program Installers", this would become "C
Progra~2".
Ok, enough geeking now...
Since Windows 95/98 (can't remember which) Windows now uses long filenames (LFN) which can be up to 256 characters and any dots are your own decision.
To convert a LFN to 8.3 format, take the first 6 characters ignoring spaces
and add ~N onto it - where N is usually 1. If there are multiple files in a folder with the same 6 characters prefix, N increments for each of them in alphabetical order. If it is a file, not a folder, you can then append the .xxx extension.
So, "C
Program Files" would become "C
Progra~1"If there was also "C
Program Installers", this would become "C
Progra~2".Ok, enough geeking now...
Plastic PPRuNer

Joined: Sep 2000
Posts: 1,902
Likes: 0
From: Rochechouart, France
Careful out there. The 8.3 filename is synthesised from the LFN on the fly (it isn't static and isn't stored). The value of ~N depends on what other files there are in the directory/folder.
So mylongappname.exe might be MYLONG~1.EXE in one situation and MYLONG~2.EXE in another.
Old apps that don't understand LFNs can give you serious grief, particularly if they're doing any batch processing. Any files changed to 8.3 will have no idea what their previous LFN was.
LFNTOOLS - http://lfntools.sourceforge.net/ - might be useful to you and LFNDOS and DOSLFN (TSRs that handle long filenames under DOS) are of historical interest.
So mylongappname.exe might be MYLONG~1.EXE in one situation and MYLONG~2.EXE in another.
Old apps that don't understand LFNs can give you serious grief, particularly if they're doing any batch processing. Any files changed to 8.3 will have no idea what their previous LFN was.
LFNTOOLS - http://lfntools.sourceforge.net/ - might be useful to you and LFNDOS and DOSLFN (TSRs that handle long filenames under DOS) are of historical interest.
Joined: Oct 2006
Posts: 103
Likes: 0
From: EGBJ Gloucester





