Why Windows still ships with both TMP and TEMP — a 40-year compatibility scar
The dual TMP/TEMP environment variables are a fossil of the CP/M-to-MS-DOS transition. CP/M had no environment variables at all, so programs were configured by patching bytes directly into executables. When MS-DOS introduced environment variables in 1981, no convention existed for naming a temp directory, and two camps emerged organically — some authors picked TMP, others picked TEMP, with no coordinating authority to settle it.
MS-DOS 2.0 forced the issue when it added piping, which on a single-tasking OS required spooling intermediate output to disk. COMMAND.COM picked TEMP. Windows later picked the opposite: GetTempFileName checks TMP first, then falls back to TEMP. Individual programs (DISKCOPY, EDIT) made their own ordering choices, so the variable a given tool actually honors depends on which author’s preference won out decades ago.
The upshot is that both variables persist in the Environment Variables dialog because removing either would break some long tail of software that prefers one over the other. It’s a textbook case of backward-compatibility lock-in: a coin-flip decision in the early 1980s that nobody can now unflip.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.