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.


$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)
Tech Notes
Text
Wolfram Research (2010), $InputFileName, Wolfram Language function, https://reference.wolfram.com/language/ref/$InputFileName.html (updated 2019).
CMS
Wolfram Language. 2010. "$InputFileName." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/$InputFileName.html.
APA
Wolfram Language. (2010). $InputFileName. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$InputFileName.html
BibTeX
@misc{reference.wolfram_2025_$inputfilename, author="Wolfram Research", title="{$InputFileName}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/$InputFileName.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_$inputfilename, organization={Wolfram Research}, title={$InputFileName}, year={2019}, url={https://reference.wolfram.com/language/ref/$InputFileName.html}, note=[Accessed: 11-August-2025]}