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

$InputFileName

$InputFileName
is a global variable whose value is the absolute file name of the input file from which input to Mathematica is currently being sought.
  • During the execution of <<file, $InputFileName is set to the absolute file name of file.
Loading a file:
During interactive input, $InputFileName is :
Loading a file:
 
During interactive input, $InputFileName is :
In[1]:=
Click for copyable input
Out[1]=
New in 8