/temp alias produces short form name

On my system, /temp resolves to C:\Users\AUSSIE~1\AppData\Local\Temp

whereas all other aliases (e.g. /themes) resolve the full user name

/themes = C:\Users\AussieBoykie\AppData\Roaming\Microsoft\Windows\Themes

Is there a reason for this and is there a way of forcing the long form of /temp?

What's your %TEMP% environment variable set to?

Good catch! Is this the normal value for %TEMP% or has it been changed on my system? I don't recall ever setting %TEMP%.

I was going to say mine isn't short, but then I noticed none of my usernames are over 8 characters, nor the other path components, so I don't actually know. :slight_smile:

Same here, mine is only 7 :slight_smile:

I imagine it's for backwards compatibility with programs that don't know about long filenames.

Interestingly, some other Windows "system" settings, e.g. %APPDATA%, %HOMEPATH%, %USERPROFILE% all use the full name. Only %TEMP% and %TMP% are shortened.

I was hoping that FSUtil.Resolve("/temp") would return the real (full) name but it doesn't.

This kind of thing can convert a short path to a long one:

var path = DOpus.FSUtil.NewPath("C:\\PROGRA~1");
DOpus.Output(path.longpath);

For me it only worked when the short path was all uppercase. I'm not sure if the string will be detected as a short path otherwise, or if it has to match the short path on disk (which I think is always uppercase). So your script may need to uppercase the path for it to convert properly.

1 Like

Leo's suggestion does what I want.

var path = DOpus.FSUtil.NewPath(DOpus.FSUtil.resolve("/temp"));
var fullpath = path.longpath;

As far as I know, shortnames are always uppercase and that is certainly true on my system.