I have a C++ application that is using the %tmp% variable (from the GetTempPath() function). Unfortunately there is a bug where it can't handle the tidle that may appear in the user's local temp directory path if it is generated using short file names.

What I would like to do is make it so that the %tmp% environment variable does not include a short file name, if this is possible.

In my research I came across the following commands:

fsutil.exe 8dot3name set C: 1 
fsutil.exe 8dot3name strip /s /v C:\

I have ran both of these and the first command successfully disabled short file names. The second command, however, failed for approximately 2000 existing short file names as they are already referenced in the registry. That's fine, but I really only care about that one environment variable, so was wondering if there was a way I could either force remove that short file name, or if, as I have a feeling it would be, this is not advised, if there is a way I can force the environment variable to use the long file name? I understand that the %tmp% variable uses the %userprofile% variable, and that the latter is actually the offending variable, so I take it it is that one I will need to look at ..?

Any help would be greatly advised.



Maybe I'm too late for you, but perhaps it helps somone else:

the GetLongPathName() function should convert the short name to a long one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.