8.3 Short Names in Coding

jcgriff2

Co-Founder / Admin
BSOD Instructor/Expert
Microsoft MVP (Ret.)
Staff member
Joined
Feb 19, 2012
Posts
21,541
Location
New Jersey Shore
I know the 8.3 short name was the max length of a file name in DOS.
Code:
abcdefgh.xyz

It carries through to Windows 8, although obviously no longer a requirement.

I never gave thought to its use in batch (or other languages calling a shell) until early this morning, i.e., whether the shortening of a name to include a tilde ~ in a folder or filename flowed through or not (if not used on purpose) -

12-19-2012_MikeBSODApp_ProcMon_tempDIR.png

The CMD screen shows the 8.3 file name for my laptop here as I was accessing the TEMP dirs -
Code:
 Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\PalmDesert>[COLOR=#0000FF]echo %temp%[/COLOR]
[B]C:\Users\[COLOR=#FF0000]PALMDE~1[/COLOR]\AppData\Local\Temp[/B]

C:\Users\PalmDesert>cd appdata\local\temp

[B]C:\Users\[COLOR=#FF0000]PalmDesert[/COLOR]\AppData\Local\Temp[/B]>

Nothing surprising there, but the other portion of the screenshot is from SysInternals Process Monitor.

I've never seen an 8.3 name in ProcMon before. Could the app it passed through have an issue with the ~ ? I know that batch may in FOR loop or other unexpected place it shows up.

Why would C++ or other modern language be using the 8.3?

What does %~d0 mean in a Windows batch file? - Stack Overflow

This is not a rhetorical question! I honestly do not know.
 
Last edited:
Hmmmmm... this is interesting...

Running the same style cmd lines from my PC doesn't show much, since my user name is less than 8 characters long. However, a ProcMon screenshot from general activity, nothing special. Some ~ in the procmon log -

ProcMon.png
 
Maybe it is common & I just never noticed it over the last few years!

Is the first one PROGRA~1 on the same line as Public as if to say it is the name of a user account? It could also be a file name.

Let's find out! Bring up an ADMIN CMD screen, then paste -
Code:
dir c:\users  /a /d /x > "%temp%\0" & start notepad "%temp%\0"

A Notepad will open. The 8.3 name is in the middle.
 
Code:
 Volume in drive C is OS
 Volume Serial Number is B845-7168

 Directory of c:\users

14/10/2012  07:08 PM    <DIR>                       .
14/10/2012  07:08 PM    <DIR>                       ..
14/07/2009  05:08 AM    <SYMLINKD>     ALLUSE~1     All Users [C:\ProgramData]
28/01/2012  01:19 PM    <DIR>                       Default
14/07/2009  05:08 AM    <JUNCTION>     DEFAUL~1     Default User [C:\Users\Default]
14/07/2009  04:54 AM               174              desktop.ini
01/07/2012  08:09 PM    <DIR>                       Guest
11/10/2012  06:32 PM    <DIR>                       Public
12/12/2012  09:54 PM    <DIR>                       Stephen
01/07/2012  08:09 PM    <DIR>          UPDATU~1     UpdatusUser
               1 File(s)            174 bytes
               9 Dir(s)  513,209,135,104 bytes free
 
I can't tell from the screenshot what's aligned with. It may be a sub-dir of Public because these 3 I see elsewhere -
Code:
12/12/2012  16:37    <DIR>          [COLOR="#FF0000"]PROGRA~1[/COLOR]     Program Files
12/12/2012  16:37    <DIR>          PROGRA~2     Program Files (x86)
09/29/2012  00:01    <DIR>          PROGRA~3     ProgramData

From an ADMIN CMD screen; paste -
Code:
dir %public% /a /d /x > "%temp%\0" & start notepad "%temp%\0"

A Notepad will open. The 8.3 name is in the middle.

The 8.3's are not a problem. I'm just curious as I don't recall seeing them in ProcMon before.

My post #1 screenshot was from a SysnativeBSODApps.exe run monitored by ProcMon
 
Last edited:
I think every long file name in Windows also has an 8.3 name. The names are generated purely for backwards compatibility.

Why would C++ or other modern language be using the 8.3?

Nothing to do with C++, the filenames are generated by Windows to maintain backwards compatibility. As for "modern languages" - the most common standard for C++ is from 1998 and Windows still heavily uses C.
 
I can't tell from the screenshot what's aligned with. It may be a sub-dir of Public because these 3 I see elsewhere -
Code:
12/12/2012  16:37    <DIR>          [COLOR=#FF0000]PROGRA~1[/COLOR]     Program Files
12/12/2012  16:37    <DIR>          PROGRA~2     Program Files (x86)
09/29/2012  00:01    <DIR>          PROGRA~3     ProgramData

From an ADMIN CMD screen; paste -
Code:
dir %public% /a /d /x > "%temp%\0" & start notepad "%temp%\0"

A Notepad will open. The 8.3 name is in the middle.

The 8.3 are not a problem. I've don't recall seeing them in ProcMon before.

My post #1 screenshot was from a SysnativeBSODApps.exe run monitored by ProcMon

Now that's interesting... Take a look at this -
Code:
 Volume in drive C is OS
 Volume Serial Number is B845-7168

 Directory of C:\Users\Public

11/10/2012  06:32 PM    <DIR>                       .
11/10/2012  06:32 PM    <DIR>                       ..
14/04/2012  04:33 PM    <DIR>          CYBERL~1     CyberLink
18/12/2012  09:06 PM    <DIR>                       Desktop
14/07/2009  04:54 AM               174              desktop.ini
17/02/2012  03:38 PM    <DIR>          DOCUME~1     Documents
29/09/2012  04:52 PM    <DIR>          DOWNLO~1     Downloads
14/07/2009  02:34 AM    <DIR>          FAVORI~1     Favorites
05/07/2012  09:38 AM    <DIR>          LIBRAR~1     Libraries
22/08/2012  03:17 PM    <DIR>          MUMBAN~1     Mum band concert july 2012
14/07/2009  04:54 AM    <DIR>                       Music
28/01/2012  02:57 PM    <DIR>                       Pictures
01/07/2012  08:09 PM    <DIR>          RECORD~1     Recorded TV
28/01/2012  01:19 PM    <DIR>                       Roaming
11/10/2012  06:32 PM                92 SDELEV~1.TMP sdelevURL.tmp
14/07/2009  04:54 AM    <DIR>                       Videos
               2 File(s)            266 bytes
              14 Dir(s)  512,257,490,944 bytes free
 
I believe Will is correct. If I remember correctly it was some kind of "Registry Hack" (for want of a better term) that renamed long file names back to the 8-3 standard. Spaces were removed and the first 6 characters of the file name were then used, plus the tilde and then a number. So, Longfilename.exe would become LONGFI~1.exe. Something like that anyway.
 
What I find confusing is why an I/O event by a modern-day C++ app shows up in ProcMon using 8.3 -

2791

. . . and only for \appdata\local\temp directory & not the others.
 
Last edited:
What I find confusing is why an I/O event by a modern-day C++ app shows up in ProcMon using 8.3 -

It's nothing to do with the app, or C++. The windows temp directory by default seems to always identify itself using the 8.3 filename, unless these are disabled. Run this command:

cd %temp%

You'll see the 8.3 filename - I do even for Windows 8. I expect it's just legacy code - if Microsoft changes how the %temp% directory displays then potentially a lot of apps don't work.
 
Per my screenshot both 8.3 & non-8.3 appear - but just for %temp%, not the other directories.

cd %temp% gives the same 8.3 as echo %temp% does -

Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\PalmDesert>[COLOR="#FF0000"]cd %temp%[/COLOR]

C:\Users\PALMDE~1\AppData\Local\Temp>


The CMD screen shows the 8.3 file name for my laptop here as I was accessing the TEMP dirs -
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\PalmDesert>[COLOR=#0000FF]echo %temp%[/COLOR]
[B]C:\Users\[COLOR=#FF0000]PALMDE~1[/COLOR]\AppData\Local\Temp[/B]

C:\Users\PalmDesert>cd appdata\local\temp

[B]C:\Users\[COLOR=#FF0000]PalmDesert[/COLOR]\AppData\Local\Temp[/B]>


I'm beating this dead-horse to death for a specific reason as a download failed; but only when the 8.3 appears in ProcMon, which does not occur every run & I have no idea if 8.3 is an issue here or not -- & agree it should not be. :smile9:
 
My understanding is this. According to MS, the reason of the 8.3 support is:
to allow MS-DOS-based or 16-bit Windows-based programs to access the files.

Now, taking W7 here, W7 32bit CAN run 16bit MS-DOS applications as well as 32bit programs, but W7 64bit can only run 32/64bit programs. I got the MS quote from an article in the MS KB from W95/98/ME, but it still applies to W7. W7 32bit does use these 8.3 names, since it supports the 16bit programs which needs them. However, whilst 64bit W7 cannot run 16bit programs, it keeps the feature. Not sure why 64bit needs to keep it, but it's probably built into the kernel somewhere and hard to remove.

It is possible to disable/enable 8.3 support at will, but bear in mind that 16bit programs have no chance of running if 8.3 is disabled.
a. Start Registry Editor (Regedt32.exe).
b. Locate the NtfsDisable8dot3NameCreation value under the following key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
c. Double click on NtfsDisable8dot3NameCreation. Type 0 for value data and then click OK.
d. Quit Registry Editor.
e. Restart the computer.
 
Thanks, but I'll pass on disable!

I'll see what future ProcMon runs show.

SysnativeBSODApps + failed DRT d/l are involved here; hence the reason I'm looking at everything that remotely appears different.

Thank you, everyone!
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top