Linux tmp directory on Windows

Linux operating systems have a special directory (/tmp) that is emptied each time the operating system reboots. It’s the perfect location to store temporary files that won’t be needed in the future, such as downloaded installer files or extracted archives. Windows has no direct equivalent of the /tmp directory and this can be frustrating to those who’ve grown used to it.

Fortunately, it’s easy to create your own Linux-style temporary directory on Windows:

  1. Create an empty folder, such as C:\tmp.
  2. Browse to the Startup directory in your Start Menu, right-click and select Open.
  3. Create a new file in your Startup folder called deletetmp.bat. Edit this file and add the following three lines:
set TMP_PATH="C:\tmp"
RD /S /Q %TMP_PATH%
mkdir %TMP_PATH%

This batch file will delete and recreate the temporary directory each time Windows starts.