gives the file name of the current evaluation notebook.
NotebookFileName[nb]
gives the file name for the notebook specified by nb.
NotebookFileName
gives the file name of the current evaluation notebook.
NotebookFileName[nb]
gives the file name for the notebook specified by nb.
Details
- NotebookFileName returns the absolute file name for the notebook as a string.
- NotebookFileName gives $Failed if the specified notebook has never been saved as a file.
- The file name given by NotebookFileName is on the filesystem of the computer on which the notebook front end is being run.
Examples
Basic Examples (2)
Get the name of the file for the current evaluation notebook:
NotebookFileName[]//FileNameTakeCreate a notebook, save it in a file and then open it:
NotebookSave[Notebook[{Cell["Hello", "Text"]}], FileNameJoin[{$TemporaryDirectory, "Hello.nb"}]]nb = NotebookOpen[FileNameJoin[{$TemporaryDirectory, "Hello.nb"}]];Find the file name for the notebook:
NotebookFileName[nb]Close the notebook and delete the file:
NotebookClose[nb]DeleteFile[FileNameJoin[{$TemporaryDirectory, "Hello.nb"}]]Related Guides
Related Workflows
- Get Information on the Current Notebook ▪
- Find the Size of a Notebook ▪
- Construct a File Path Programmatically
History
Text
Wolfram Research (2008), NotebookFileName, Wolfram Language function, https://reference.wolfram.com/language/ref/NotebookFileName.html.
CMS
Wolfram Language. 2008. "NotebookFileName." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NotebookFileName.html.
APA
Wolfram Language. (2008). NotebookFileName. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NotebookFileName.html
BibTeX
@misc{reference.wolfram_2026_notebookfilename, author="Wolfram Research", title="{NotebookFileName}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/NotebookFileName.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_notebookfilename, organization={Wolfram Research}, title={NotebookFileName}, year={2008}, url={https://reference.wolfram.com/language/ref/NotebookFileName.html}, note=[Accessed: 13-June-2026]}