# How to use an underscore in a filename

With the commands \openout and \write I output text into a file. I want this file to have a name of containing an underscore (eg. name_01.txt), but I'm unable to get the underscore in the filename. My attempt (with \_):

\documentclass{article}
\begin{document}
\newwrite\tempfile
\immediate\openout\tempfile="name\_01.txt"
\immediate\write\tempfile{this is interesting}
\immediate\closeout\tempfile
\end{document}

-

\immediate\openout\tempfile="name\string_01.txt"

-
\immediate\openout\tempfile="name_01.txt"