Why are there both TMP and TEMP environment variables, and which one is right?

· ai · Source ↗

TLDR

  • TMP and TEMP both exist due to parallel, uncoordinated adoption during the MS-DOS era, with no single authority ever declaring a winner.

Key Takeaways

  • MS-DOS introduced environment variables as an addition beyond CP/M compatibility; no early programs used them since all were CP/M ports.
  • MS-DOS 2.0 pipe simulation needed a temp file location; COMMAND.COM authors chose TEMP, cementing its early lead.
  • Competing programs independently picked TEMP or TMP, with check order varying by author preference – no standard emerged.
  • Windows GetTempFileName looks for TMP before TEMP, reversing COMMAND.COM’s priority; Windows apps generally follow this.
  • Both variables still coexist in Windows Environment Variables settings today, unresolved after 40+ years.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN