Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 15 down vote accepted

If the notebook is saved, you can use:


or simply (thanks to @rm -rf)


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

NotebookFileName[] // FileNameSplit // Last

Alternatively, even for unsaved notebooks, try:

CurrentValue[EvaluationNotebook[], {"NotebookFileName"}]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.