How to? Problem with @SFN (short filenames)

Dec 7, 2009
238
2
Left Coast, USA
A search didn't quickly turn up a topic like this...

I was using a semi-ancient version of TCC and am now using:

TCC 20.00.14 x64 Windows 10 [Version 6.3.14393]
TCC Build 14 Windows 10 Build 14393


I don't recall having had problems with
%@sfn[] in the past, but I'm seeing some now. Example:

c:\> echo %@sfn["Program Files"]
(result:) C:\PROGRA~1 (expected)

c:\> echo %@sfn[%programfiles]
(result:) C:\PROGRA~1

I made a "Program Files" directory on D: as well.

d:\> echo %@sfn["Program Files"]
(result:) D:\Program Files (unexpected)

c:\> set zorch=D:\Program Files
c:\> echo %@sfn[%zorch]
(result:) D:\Program Files

Now change the "D:" to "C:" in the variable:


d:\> set zorch=C:\Program Files

Now . . .
d:\> echo %@sfn[%zorch]
(result:) C:\PROGRA~1

So the @SFN function doesn't seem to work at all with file or directory names on this laptop's D: drive. I noticed this when I upgraded from the semi-ancient TCC version to v.19 and noticed it again on installing v.20 today.

I don't recall that sort of thing being a problem in the past. Is it WAD? If so, what's the basis for the difference? And if so, is there some other way to return short filenames on D: without having to resort to using a cmd.exe-style "for" loop? (UGH)

I also notice that whereas Control+A toggles between SFNs and LFNs on drive C:, it doesn't work on drive D.
 
Are both drives NTFS? It is possible (but I never heard of it being done) to disable 8dot3 name creation on NTFS drive by drive. Try this (elevated) for c: and d:.
Code:
v:\> fsutil 8dot3name query c:
The volume state for Disable8dot3 is 0 (8dot3 name creation is enabled).
The registry state of NtfsDisable8dot3NameCreation is 1 (Disable 8dot3 name creation on all volumes).
Based on the above two settings, 8dot3 name creation is disabled on c:.
 
Are both drives NTFS? It is possible (but I never heard of it being done) to disable 8dot3 name creation on NTFS drive by drive. Try this (elevated) for c: and d:.
Code:
v:\> fsutil 8dot3name query c:
The volume state for Disable8dot3 is 0 (8dot3 name creation is enabled).
The registry state of NtfsDisable8dot3NameCreation is 1 (Disable 8dot3 name creation on all volumes).
Based on the above two settings, 8dot3 name creation is disabled on c:.

Well by Godfrey you've nailed it. Thanks very much for this suggestion. Both drives are NTFS. The output of your suggested command:

The volume state is: 1 (8dot3 name creation is disabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above two settings, 8dot3 name creation is disabled on d:

I did a web search for more information about this — it's harder to find than I'd expected — and turned up:

fsutil.exe behavior set disable8dot3 0

Does that look like the right command? Is it a setting that "sticks" once you've disabled the disabling? (as it were)

Then I should ask Lenovo what's the deal with having it the one way on the one drive and not on the other.

Thanks again!
 
I don't know about that command. If there's a specific "disabled" registry entry for d:, that may override it. Experiment ... of keep Googling. :-)
 

Similar threads