# Name of current Notebook

I've searched the documentation, this forum and with google, but I was not able to find how to ask Mathematica to give back the name of the current notebook file one is working on. Perhaps something with EvaluationNotebook[], but that gives a NotebookObject. How is it possible to use this information to retain just the filename?

-
AbsoluteOptions[EvaluationNotebook[], WindowTitle] ? –  Kuba Sep 16 '13 at 11:49
or if it is saved (is it?): NotebookFileName[EvaluationNotebook[]] –  Pinguin Dirk Sep 16 '13 at 11:49
The notebook is indeed saved, that was precisely what I was searching for... Thanks, once again! –  Gabriel Sep 16 '13 at 14:21

If the notebook is saved, you can use:

NotebookFileName[EvaluationNotebook[]]


or simply (thanks to @rm -rf)

NotebookFileName[]


and if it's just the file's name you are after:

NotebookFileName[] // FileNameSplit // Last


Alternatively, even for unsaved notebooks, try:

CurrentValue[EvaluationNotebook[], {"NotebookFileName"}]

-