$InputFileName

$InputFileName

is a global variable whose value is the absolute file name of the input file from which input to the Wolfram Language is currently being sought.

Details

  • During the execution of <<file, $InputFileName is set to the absolute file name of file.
  • During the execution of a script file through wolframscript, $InputFileName is set to the absolute file name of the script file.
  • When input does not come from a file, or comes from an interactive session, $InputFileName is "".

Examples

Basic Examples  (2)

Loading a file:

During interactive input, $InputFileName is "":

Introduced in 2010
 (8.0)
 |
Updated in 2019
 (12.0)