Looking at it again, it seems that if neither %SystemRoot% or %windir% is set, it'll return `'undefined\\temp'`.

/cc @piscisaureus