({{, (RefLink[$ScriptCommandLine, paclet:ref/$ScriptCommandLine]) 
is a list of strings giving the elements of the command line with which the standalone Wolfram System script was invoked.}})

OpenersNotesSection(Spacer1)Details

If the Wolfram Language kernel was invoked via a (RefLink[wolframscript, paclet:ref/program/wolframscript]) mechanism, the (RefLink[$ScriptCommandLine, paclet:ref/$ScriptCommandLine]) contains the elements of the command line, starting with the name of the script.

If the Wolfram Language kernel was run in a way other than via a (RefLink[wolframscript, paclet:ref/program/wolframscript]) mechanism, the (RefLink[$ScriptCommandLine, paclet:ref/$ScriptCommandLine]) gives an empty list.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

(RefLink[$ScriptCommandLine, paclet:ref/$ScriptCommandLine]) is empty in an interactive session:

$ScriptCommandLine

Find the (RefLink[wolframscript, paclet:ref/program/wolframscript]) executable:

wolframscript="!\""<>FileNameJoin[{$LaunchDirectory,"wolframscript"}]<>"\"";

Set up appropriate arguments for the operating system:

args=If[$OperatingSystem=="Windows"," -code $ScriptCommandLine"," -code '$ScriptCommandLine'"];

(RefLink[$ScriptCommandLine, paclet:ref/$ScriptCommandLine]) will include the executable and its arguments when launched:

Import[wolframscript<>args,"Text"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[$CommandLine, paclet:ref/$CommandLine])  ▪  (RefLink[$InputFileName, paclet:ref/$InputFileName])  ▪  (RefLink[$BatchInput, paclet:ref/$BatchInput])}, {Related Programs:  (RefLink[wolframscript, paclet:ref/program/wolframscript])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Wolfram Language Scripts, paclet:tutorial/WolframLanguageScripts])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Standalone Wolfram Language Kernels, paclet:guide/StandaloneWolframLanguageKernels])}, {▪(RefLinkPlain[Package Development, paclet:guide/PackageDevelopment])}})}})