$BatchInput
✖
$BatchInput
is True if input in the current session is being fed directly to the Wolfram Language kernel in batch mode.
Details

- $BatchInput is True if input is being taken from a file.
- $BatchInput can be reset during a Wolfram System session.
- When $BatchInput is True, the Wolfram System terminates if it ever receives an interrupt, does not discard input when blank lines are given, and terminates when it receives end‐of‐file.
Examples
Basic Examples (2)Summary of the most common use cases
In an interactive session, $BatchInput is False by default:

https://wolfram.com/xid/0btpqqu3hazy-bfavwf

Run a standalone Wolfram Language kernel with an input file:

https://wolfram.com/xid/0btpqqu3hazy-exopde

https://wolfram.com/xid/0btpqqu3hazy-dt9mj2


https://wolfram.com/xid/0btpqqu3hazy-c3zs0b

Put commands in a file, in this case to evaluate $BatchInput:

https://wolfram.com/xid/0btpqqu3hazy-cv0cpe


https://wolfram.com/xid/0btpqqu3hazy-fqsh8y
Run the command. The session terminates at the end of the file:

https://wolfram.com/xid/0btpqqu3hazy-y1h5v

The output file contains the value of $BatchInput:

https://wolfram.com/xid/0btpqqu3hazy-g221kr

https://wolfram.com/xid/0btpqqu3hazy-h4s8dg
Wolfram Research (1991), $BatchInput, Wolfram Language function, https://reference.wolfram.com/language/ref/$BatchInput.html.
Text
Wolfram Research (1991), $BatchInput, Wolfram Language function, https://reference.wolfram.com/language/ref/$BatchInput.html.
Wolfram Research (1991), $BatchInput, Wolfram Language function, https://reference.wolfram.com/language/ref/$BatchInput.html.
CMS
Wolfram Language. 1991. "$BatchInput." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$BatchInput.html.
Wolfram Language. 1991. "$BatchInput." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$BatchInput.html.
APA
Wolfram Language. (1991). $BatchInput. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$BatchInput.html
Wolfram Language. (1991). $BatchInput. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$BatchInput.html
BibTeX
@misc{reference.wolfram_2025_$batchinput, author="Wolfram Research", title="{$BatchInput}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/$BatchInput.html}", note=[Accessed: 07-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_$batchinput, organization={Wolfram Research}, title={$BatchInput}, year={1991}, url={https://reference.wolfram.com/language/ref/$BatchInput.html}, note=[Accessed: 07-June-2025
]}