This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

$TemporaryDirectory

$TemporaryDirectory
gives the main system directory for temporary files on your computer system.
  • Mathematica does not automatically delete files it creates in the $TemporaryDirectory directory, although the operating system may do so.
Show the path for the temporary directory:
Open a stream for writing in the temporary directory:
Close the stream:
Print the resulting file:
Show the path for the temporary directory:
In[1]:=
Click for copyable input
Out[1]=
Open a stream for writing in the temporary directory:
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Close the stream:
In[4]:=
Click for copyable input
Out[4]=
Print the resulting file:
New in 7