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

Documentation / Mathematica / Built-in Functions / Input and Output / Basic Operations /

Get

FilledSmallSquare <<name reads in a file, evaluating each expression in it, and returning the last one.

FilledSmallSquare On systems with graphical interfaces, there will usually be graphical tools for reading in files.

FilledSmallSquare If name is the name of a Mathematica context, ending with a ` context mark character, then Get will process this name to find the file to read.

FilledSmallSquare If name is the name of a file, any .m extension must be included explicitly.

FilledSmallSquare Get can read .mx files of Mathematica definitions written by DumpSave.

FilledSmallSquare <<"name" is equivalent to <<name. The double quotes can be omitted if the name is of the form specified in Section A.2.7.

FilledSmallSquare If a file with name file.mx is found to be a directory, Get will look for a file with a name like file.mx/$SystemID/file.mx.

FilledSmallSquare If the file found by <<name is a directory, Mathematica will try to load the file init.m in that directory.

FilledSmallSquare Get by default successively searches for files in the directories specified by the elements of $Path.

FilledSmallSquare Get[name, Path->"", "", ... ] successively searches for files in each of the .

FilledSmallSquare Syntax errors in Mathematica input files are reported in the standard form: filename: line: syntax error in expr. Get continues attempting to read a file even after a syntax error has been detected. However, if an error is detected, $Context and $ContextPath are reset to the values they had when Get was called.

FilledSmallSquare During the execution of Get, the global variable $Input is set to the name of the file being read.

FilledSmallSquare Get["file", "key"] reads a file which has been encoded using Encode["source", "file", "key"].

FilledSmallSquare See Section 1.11.1, Section 1.11.10, Section 2.7.10 and Section 2.12.1.

FilledSmallSquare See also: Read, Install, RunThrough, Put, Splice, FileNames, ToFileName, ToExpression, NotebookGet.

FilledSmallSquare New in Version 1; modified in 3.

Further Examples