TMP and TEMP both exist on Windows due to parallel, uncoordinated adoption during the MS-DOS era, with no single authority ever resolving the conflict.
Key Takeaways
MS-DOS introduced environment variables as a CP/M extension; early programs ignored them entirely since all first DOS software was ported from CP/M.
COMMAND.COM pipe simulation (MS-DOS 2.0) picked TEMP to store its temp files, giving that variable an early foothold.
Windows GetTempFileName prefers TMP over TEMP, reversing COMMAND.COM’s priority and cementing the split.
Programs that try to support both check them in whichever order the original author preferred, so behavior is effectively undefined without both variables set to the same path.
Hacker News Comment Review
Commenters flagged a timeline error: Raymond dates CP/M to 1973 microcomputers, but CP/M ran only on a PDP-10 simulator then and was not on real microcomputers until closer to 1974-1979.
One commenter offered a plausible extra reason TMP won mindshare: MS-DOS file extensions max out at 3 characters, so .TMP was the natural temp-file extension, reinforcing that variable name.
Consensus takeaway: keep TMP and TEMP pointing to the same directory to avoid cross-program inconsistency.
Notable Comments
@Someone: .TMP as the standard 3-char temp extension likely nudged authors toward the TMP variable name independently of any OS decision.