3 // (C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.<BR>
4 // Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
5 // SPDX-License-Identifier: BSD-2-Clause-Patent
9 // UefiShellLevel2CommandsLib.uni
13 // String definitions for UEFI Shell 2.0 level 1 commands
20 #langdef en-US "english"
22 #string STR_NO_SCRIPT #language en-US "The command '%H%s%N' is incorrect outside of a script\r\n"
23 #string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n"
24 #string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n"
25 #string STR_GEN_PROBLEM_SCRIPT #language en-US "The argument '%B%s%N' is incorrect. Line: %d\r\n"
26 #string STR_GEN_INV_VAR #language en-US "The script's Indexvar '%B%s%N' is incorrect\r\n"
27 #string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments\r\n"
28 #string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments\r\n"
29 #string STR_GEN_PARAM_INV #language en-US "%H%s%N: Invalid argument - '%H%s%N'\r\n"
31 #string STR_TEXT_AFTER_THEN #language en-US "%H%s%N: Then cannot be followed by anything\r\n"
32 #string STR_SYNTAX_AFTER_BAD #language en-US "%H%s%N: Syntax after '%H%s%N' is incorrect\r\n"
33 #string STR_SYNTAX_IN #language en-US "Syntax after analyzing %s\r\n"
34 #string STR_SYNTAX_NO_MATCHING #language en-US "No matching '%H%s%N' for '%H%s%N' statement found. Line: %d\r\n"
35 #string STR_INVALID_BINOP #language en-US "Binary operator not found first in '%H%s%N'\r\n"
36 #string STR_SYNTAX_STARTING #language en-US "Syntax after %s\r\n"
38 #string STR_STALL_FAILED #language en-US "%H%s%N: BootService Stall() failed\r\n"
40 #string STR_GET_HELP_EXIT #language en-US ""
41 ".TH exit 0 "exits the script or shell"\r\n"
43 "Exits the UEFI Shell or the current script.\r\n"
46 "EXIT [/b] [exit-code]\r\n"
49 " /b - Indicates that only the current UEFI shell script should be\r\n"
50 " terminated. Ignored if not used within a script.\r\n"
51 " exit-code - If exiting a UEFI shell script, the value that will be placed\r\n"
52 " into the environment variable lasterror. If exiting an instance\r\n"
53 " of the UEFI shell, the value that will be returned to the\r\n"
54 " caller. If not specified, then 0 will be returned.\r\n"
58 " 1. This command exits the UEFI Shell or, if /b is specified, the current\r\n"
63 " * To exit shell successfully:\r\n"
66 " * To exit the current UEFI shell script:\r\n"
67 " Shell> exit /b \r\n"
69 " * To exit a UEFI shell script with exit-code value returned to the caller:\r\n"
71 ".SH RETURNVALUES\r\n"
74 " 0 Exited normally\r\n"
75 " exit-code The return value specified as an option.\r\n"
77 #string STR_GET_HELP_FOR #language en-US ""
78 ".TH for 0 "starts a for loop"\r\n"
80 "Starts a loop based on 'for' syntax.\r\n"
83 "FOR %indexvar IN set\r\n"
84 " command [arguments]\r\n"
85 " [command [arguments]]\r\n"
89 "FOR %indexvar RUN (start end [step])\r\n"
90 " command [arguments]\r\n"
91 " [command [arguments]]\r\n"
96 " %indexvar - Variable name used to index a set\r\n"
97 " set - Set to be searched\r\n"
98 " command [arguments] - Command to be executed with optional arguments\r\n"
102 " 1. The FOR command executes one or more commands for each item in a set of\r\n"
103 " items. The set may be text strings or filenames or a mixture of both,\r\n"
104 " separated by spaces (if not in a quotation).\r\n"
105 " 2. If the length of an element in the set is between 0 and 256, and if the\r\n"
106 " string contains wildcards, the string will be treated as a file name\r\n"
107 " containing wildcards, and be expanded before command is executed.\r\n"
108 " 3. If after expansion no such files are found, the literal string itself is\r\n"
109 " kept. %indexvar is any alphabet character from 'a' to 'z' or 'A' to 'Z',\r\n"
110 " and they are case sensitive. It should not be a digit (0-9) because\r\n"
111 " %digit will be interpreted as a positional argument on the command line\r\n"
112 " that launches the script. The namespace for index variables is separate\r\n"
113 " from that for environment variables, so if %indexvar has the same name as\r\n"
114 " an existing environment variable, the environment variable will remain\r\n"
115 " unchanged by the FOR loop.\r\n"
116 " 4. Each command is executed once for each item in the set, with any\r\n"
117 " occurrence of %indexvar in the command replacing with the current item.\r\n"
118 " In the second format of FOR ... ENDFOR statement, %indexvar will be\r\n"
119 " assigned a value from start to end with an interval of step. Start and\r\n"
120 " end can be any integer whose length is less than 7 digits excluding sign,\r\n"
121 " and it can also applied to step with one exception of zero. Step is\r\n"
122 " optional, if step is not specified it will be automatically determined by\r\n"
123 " following rule:\r\n"
124 " if start <= end then step = 1, otherwise step = -1.\r\n"
125 " start, end and step are divided by space.\r\n"
129 " * Sample FOR loop - listing all .txt files:\r\n"
131 " for %a in *.txt\r\n"
132 " echo %a exists\r\n"
136 " # If in current directory, there are 2 files named file1.txt and file2.txt\r\n"
137 " # then the output of the sample script will be as shown below.\r\n"
139 " Sample1> echo -off\r\n"
140 " file1.txt exists\r\n"
141 " file2.txt exists\r\n"
143 " * Theoretically it is legal for 2 nested FOR commands to use the same\r\n"
144 " alphabet letter as their index variable, for instance, a: \r\n"
146 " # Sample FOR loop from 1 to 3 with step 1\r\n"
149 " for %a run (1 3)\r\n"
154 " # Sample FOR loop from 3 down to 1 with step -1\r\n"
157 " for %a run (3 1 -1)\r\n"
162 " # Sample FOR loop - 2 nested for using same index variable\r\n"
165 " for %a in value1 value2\r\n"
166 " for %a in value3 value4\r\n"
171 " Note: When processing first FOR and before seeing the ENDFOR, the index\r\n"
172 " variable %a has the value "value1", so in second FOR, the %a has\r\n"
173 " been already defined and it will be replaced with the current value\r\n"
174 " of %a. The string after substitution becomes FOR value1 in value3\r\n"
175 " value4, which is not a legal FOR command. Thus only when the value\r\n"
176 " of %a is also a single alphabet letter, the script will be executed\r\n"
177 " without error. If 2 independent FOR commands use the same index\r\n"
178 " variable, when the second FOR is encountered, the first FOR has\r\n"
179 " already freed the variable so there will be no problem in this case.\r\n"
181 #string STR_GET_HELP_ENDFOR #language en-US ""
182 ".TH endfor 0 "ends a for loop"\r\n"
184 "Ends a 'for' loop.\r\n"
186 "See 'for' for usage.\r\n"
188 "See 'for' for examples.\r\n"
190 #string STR_GET_HELP_GOTO #language en-US ""
191 ".TH goto 0 "moves to a label"\r\n"
193 "Moves around the point of execution in a script.\r\n"
199 " label - Specifies a location in batch file\r\n"
200 ".SH DESCRIPTION\r\n"
203 " 1. The GOTO command directs script file execution to the line in the script\r\n"
204 " file after the given label. The command is not supported from the\r\n"
205 " interactive shell.\r\n"
206 " 2. A label is a line beginning with a colon (:). It can appear either after\r\n"
207 " the GOTO command, or before the GOTO command. The search for label is\r\n"
208 " done forward in the script file, from the current file position. If the\r\n"
209 " end of the file is reached, the search resumes at the top of the file and\r\n"
210 " continues until label is found or the starting point is reached. If label\r\n"
211 " is not found, the script process terminates and an error message is\r\n"
212 " displayed. If a label is encountered but there is no GOTO command\r\n"
213 " executed, the label lines are ignored.\r\n"
214 " 3. Using GOTO command to jump into another for loop is not allowed,\r\n"
215 " but jumping into an if statement is legal.\r\n"
219 " * This is a script:\r\n"
225 #string STR_GET_HELP_ENDIF #language en-US ""
226 ".TH endif 0 "ends an if block"\r\n"
228 "Ends the block of a script controlled by an 'if' statement.\r\n"
230 "See 'if' for usage.\r\n"
232 "See 'if' for examples.\r\n"
234 #string STR_GET_HELP_IF #language en-US ""
235 ".TH if 0 "controls the execution of a block of a script"\r\n"
237 "Executes commands in specified conditions.\r\n"
240 "IF [NOT] EXIST filename THEN\r\n"
241 " command [arguments]\r\n"
242 " [command [arguments]]\r\n"
245 " command [arguments]\r\n"
246 " [command [arguments]]\r\n"
251 "IF [/i] [NOT] string1 == string2 THEN\r\n"
252 " command [arguments]\r\n"
253 " [command [arguments]]\r\n"
256 " command [arguments]\r\n"
257 " [command [arguments]]\r\n"
261 "if [/i][/s] ConditionalExpression THEN\r\n"
262 " command [arguments]\r\n"
263 " [command [arguments]]\r\n"
266 " command [arguments]\r\n"
267 " [command [arguments]]\r\n"
271 ".SH DESCRIPTION\r\n"
274 " 1. The IF command executes one or more commands before the ELSE or ENDIF\r\n"
275 " commands, if the specified condition is TRUE; otherwise commands between\r\n"
276 " ELSE (if present) and ENDIF are executed.\r\n"
277 " 2. In the first usage of IF, the EXIST condition is true when the file\r\n"
278 " specified by filename exists. The filename argument may include device\r\n"
279 " and path information. Also wildcard expansion is supported by this form.\r\n"
280 " If more than one file matches the wildcard pattern, the condition\r\n"
281 " evaluates to TRUE.\r\n"
282 " 3. In the second usage, the string1 == string2 condition is TRUE if the two\r\n"
283 " strings are identical. Here the comparison can be case sensitive or\r\n"
284 " insensitive, it depends on the optional switch /i. If /i is specified,\r\n"
285 " it will compare strings in the case insensitive manner; otherwise, it\r\n"
286 " compares strings in the case sensitive manner.\r\n"
287 " 4. In the third usage, general purpose comparison is supported using\r\n"
288 " expressions optionally separated by AND or OR. Since < and > are used for\r\n"
289 " redirection, the expressions use common two character (FORTRAN)\r\n"
290 " abbreviations for the operators (augmented with unsigned equivalents):\r\n"
291 " - Expressions : Conditional expressions are evaluated strictly from left\r\n"
292 " to right. Complex conditionals requiring precedence may\r\n"
293 " be implemented as nested IFs.\r\n"
294 " The expressions used in the third usage can have the\r\n"
295 " following syntax:\r\n"
296 " conditional-expression := expression |\r\n"
297 " expression and expression |\r\n"
298 " expression or expression\r\n"
299 " expression := expr | not expr\r\n"
300 " expr := item binop item | boolfunc(string)\r\n"
301 " item := mapfunc(string) | string\r\n"
302 " mapfunc := efierror | pierror | oemerror\r\n"
303 " boolfunc := isint | exists | available | profile\r\n"
304 " binop := gt | lt | eq | ne | ge | le | == | ugt | ult |\r\n"
306 " - Comparisons : By default, comparisons are done numerically if the\r\n"
307 " strings on both sides of the operator are numbers\r\n"
308 " (as defined below) and in case sensitive character sort\r\n"
309 " order otherwise. Spaces separate the operators from\r\n"
311 " 5. The /s option forces string comparisons and the /i option forces\r\n"
312 " case-insensitive string comparisons. If either of these is used, the\r\n"
313 " signed or unsigned versions of the operators have the same results.\r\n"
314 " The /s and /i apply to the entire line and must appear at the start of\r\n"
315 " the line (just after the if itself). The two may appear in either order.\r\n"
316 " 6. When performing comparisons, the Unicode Byte Ordering Character is\r\n"
317 " ignored at the beginning of any argument.\r\n"
318 " 7. Comparison Operator Definition:\r\n"
319 " gt : Greater than\r\n"
320 " ugt : Unsigned Greater than\r\n"
321 " lt : Less than\r\n"
322 " ult : Unsigned Less than\r\n"
323 " ge : Greater than or equal\r\n"
324 " uge : Unsigned greater than or equal\r\n"
325 " le : Less than or equal\r\n"
326 " ule : Unsigned less than or equal\r\n"
327 " ne : Not equal\r\n"
328 " eq : Equals (semantically equivalent to ==)\r\n"
329 " == : Equals (semantically equivalent to eq)\r\n"
330 " 8. Error Mapping Functions are used to convert integers into UEFI, PI or OEM\r\n"
332 " Functions used to convert integers into UEFI, PI or OEM error codes:\r\n"
333 " UefiError : Sets top nibble of parameter to 1000 binary (0x8)\r\n"
334 " PiError : Sets top nibble of parameter to 1010 binary (0xA)\r\n"
335 " OemError : Sets top nibble of parameter to 1100 binary (0xC)\r\n"
336 " Each function maps the small positive parameter into its equivalent error\r\n"
337 " classification.\r\n"
339 " if %lasterror% == EfiError(8) then # Check for write protect.\r\n"
341 " 9. Boolean Functions may only be used to modify operators in comparisons.\r\n"
342 " The following built-in Boolean functions are also available:\r\n"
343 " IsInt : Evaluates to true if the parameter string that follows\r\n"
344 " is a number (as defined below) and false otherwise.\r\n"
345 " Exists : Evaluates to true if the file specified by string exists\r\n"
346 " is in the current working directory or false if not.\r\n"
347 " Available : Evaluates to true if the file specified by string is in the\r\n"
348 " current working directory or current path.\r\n"
349 " Profile : Determines whether the parameter string matches one of the\r\n"
350 " profile names in the profiles environment variable.\r\n"
351 " 10. No spaces are allowed between function names and the open parenthesis,\r\n"
352 " between the open parenthesis and the string or between the string and\r\n"
353 " the closed parenthesis. Constant strings containing spaces must be\r\n"
355 " 11. To avoid ambiguity and current or future incompatibility, users are\r\n"
356 " strongly encouraged to surround constant strings that contain\r\n"
357 " parenthesis with quotes in if statements.\r\n"
358 " 12. Allowable number formats are decimal numbers and C-style case\r\n"
359 " insensitive hexadecimal numbers. Numbers may be preceded by a\r\n"
360 " "-" indicating a negative number.\r\n"
367 " 13. Unsigned values must be less than 264. Signed integer values are bounded\r\n"
369 " 14. Numbers are internally represented in two's compliment form. The\r\n"
370 " representation of the number in the string has no bearing on the way\r\n"
371 " that number is treated in an numeric expression - type is assigned by\r\n"
372 " the operator. So, for example, -1 lt 2 is true but -1 ult 2 is false.\r\n"
373 " 15. The IF command is only available in scripts.\r\n"
374 " 16. The ELSE command is optional in an IF/ELSE statement.\r\n"
378 " * Sample script for "if" command usages 1 and 2:\r\n"
379 " if exist fs0:\myscript.nsh then\r\n"
380 " myscript myarg1 myarg2\r\n"
382 " if %myvar% == runboth then\r\n"
386 " echo ^%myvar^% != runboth\r\n"
388 " Note: In this example, if the script file myscript.nsh exists in fs0:\,\r\n"
389 " this script will be launched with 2 arguments, myarg1 and myarg2.\r\n"
390 " After that, environment variable %myvar% is checked to see if its\r\n"
391 " value is runboth, if so, script myscript1 and myscript2 will be\r\n"
392 " executed one after the other, otherwise a message %myvar% != runboth\r\n"
395 " * Sample script for "if" command usage 3:\r\n"
397 " echo Enter 0-6 or q to quit\r\n"
398 " # assumes "input y" stores a character of user input into variable y\r\n"
400 " if x%MyVar% eq x then\r\n"
401 " echo Empty line. Try again\r\n"
404 " if IsInt(%MyVar%) and %MyVar% le 6 then\r\n"
405 " myscript1 %MyVar%\r\n"
408 " if /i %MyVar% ne q then\r\n"
409 " echo Invalid input\r\n"
412 " Note: In this example, the script requests user input and uses the if\r\n"
413 " command for input validation. It checks for empty line first and\r\n"
414 " then range checks the input.\r\n"
416 #string STR_GET_HELP_SHIFT #language en-US ""
417 ".TH shift 0 "move parameters 1 down"\r\n"
419 "Shifts in-script parameter positions.\r\n"
423 ".SH DESCRIPTION\r\n"
426 " 1. The SHIFT command shifts the contents of a UEFI Shell script's positional\r\n"
427 " parameters so that %1 is discarded, %2 is copied to %1, %3 is copied to\r\n"
428 " %2, %4 is copied to %3 and so on. This allows UEFI Shell scripts to\r\n"
429 " process script parameters from left to right.\r\n"
430 " 2. This command does not change the UEFI shell environment variable\r\n"
432 " 3. The SHIFT command is available only in UEFI Shell scripts.\r\n"
436 " * Following script is a sample of 'shift' command:\r\n"
437 " fs0:\> type shift.nsh\r\n"
445 " * To execute the script with echo on:\r\n"
446 " fs0:\> shift.nsh welcome UEFI world\r\n"
447 " shift.nsh> echo welcome UEFI world\r\n"
448 " welcome UEFI world\r\n"
450 " echo UEFI world\r\n"
453 " * To execute the script with echo off:\r\n"
454 " fs0:\> echo -off\r\n"
455 " fs0:\> shift.nsh welcome UEFI world\r\n"
456 " welcome UEFI world\r\n"
459 #string STR_GET_HELP_ELSE #language en-US ""
460 ".TH else 0 "part of an 'if' conditional statement"\r\n"
462 "Identifies the code executed when 'if' is FALSE.\r\n"
464 "See 'else' for usage.\r\n"
466 "See 'if' for examples.\r\n"
468 #string STR_GET_HELP_STALL #language en-US ""
469 ".TH stall 0 "stall the operation"\r\n"
471 "Stalls the operation for a specified number of microseconds.\r\n"
477 " time - The number of microseconds for the processor to stall.\r\n"
478 ".SH DESCRIPTION\r\n"
481 " 1. This command would be used to establish a timed STALL of operations\r\n"
482 " during a script.\r\n"
483 " 2. Microseconds is in decimal units.\r\n"
487 " * To stall the processor for 1000000 microseconds:\r\n"
488 " Shell> stall 1000000\r\n"
489 ".SH RETURNVALUES\r\n"
492 " SHELL_SUCCESS The action was completed as requested.\r\n"
493 " SHELL_NOT_FOUND The requested option was not found.\r\n"
494 " SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n"
495 " formatted or its value was out of bounds.\r\n"
496 " SHELL_DEVICE_ERROR There was a hardware error associated with this\r\n"