User`s guide
5-13
Tips and Features for Administrators
Output Redirection
Output of EFI Shell commands can be redirected to files, according to the following syntax:
Command Output Redirection
> unicode_output_file_pathname
standard output to a unicode file
>a ascii_output_file_pathname standard output to an ascii file
1> unicode_output_file_pathname standard output to a unicode file
1>a ascii_output_file_pathname standard output to an ascii file
2> unicode_output_file_pathname standard error to a unicode file
2>a ascii_output_file_pathname standard error to an ascii file
>> unicode_output_file_pathname standard output appended to a unicode file
>>a ascii_output_file_pathname standard output appended to an ascii file
1>> unicode_output_file_pathname standard output appended to a unicode file
1>>a ascii_output_file_pathname standard output appended to an ascii file
Table 29. Output redirection syntax
The Shell will redirect standard output to a single file and standard error to a single file.
Redirecting both standard output and standard error to the same file is allowed. Redirecting
Standard output to more than one file on the same command is not supported. Similarly,
redirecting to multiple files is not supported for standard error.
Quoting
Quotation marks in the EFI Shell are used for argument grouping. A quoted string is treated
as a single argument to a command, and any whitespace characters included in the quoted
string are just part of that single argument.
Quoting an environment variable does not have any effect on the de–referencing of that
variable. Double quotation marks “” are used to denote strings. Single quotation marks are
not treated specially by the Shell in any way. Empty strings are treated as valid command
line arguments.
Executing Batch Scripts
The EFI Shell has the capability of executing commands from a file (batch script). EFI Shell
batch script files are named using the .nsh extension. Batch script files can be either
UNICODE or ASCII format files. EFI Shell script files are invoked by entering the filename at
the command prompt, with or without the filename extension.
Up to nine (9) positional arguments are supported for batch scripts. Positional argument
substitution is performed before the execution of each line in the script file. Positional
arguments are denoted by %n, where n is a digit between 0 and 9. By convention, %0 is the
name of the script file currently being executed. In batch scripts, argument substitution is
performed first, then variable substitution. Thus, for a variable containing %2, the variable
will be replaced with the literal string %2, not the second argument on the command line. If
no real argument is found to substitute for a positional argument, then the positional
argument is ignored. Script file execution can be nested; that is, script files may be executed
from within other script files. Recursion is allowed.
Output redirection is fully supported. Output redirection on a command in a script file causes
the output for that command to be redirected. Output redirection on the invocation of a batch
script causes the output for all commands executed from that batch script to be redirected to
the file, with the output of each command appended to the end of the file.