Home
EFI Shell User`s Guide Draft for Review
Contents
1. EFI Shell User s Guide Commands 43 00000010 Serial Terminal Driver Terminal 44 00000010 D 1 Generic Disk I O Driver DiskIo 45 00000010 D 1 FAT File System Driver Fat 48 00000010 ISA Bus Driver IsaBus 49 00000010 ISA Serial Driver IsaSerial 4c 00000010 B 1 1 PCI Bus Driver PciBus 55 00000010 D XX 1 Windows Block I O Driver WinNtBlockIo 56 00000010 Windows Text Console Driver WinNtConsole 57 00000010 Windows Serial I O Driver WinNtSeriallIo 58 00000010 D 1 Windows Simple File System Driver WinNtSimpleFileSystem 59 00000010 B 1 3 Windows Bus Driver WinNtBusDriver 5F 00000010 D 1 Windows Universal Graphics Adapter WinNtUga Shell gt 5 5 16 drvcfg Summary Invokes the Driver Configuration Protocol EFI Versions EFI 1 10 and above 84 Commands Usage DRVCFG 1 XXX c f lt Type gt v s DriverHandle DeviceHandle ChildHandle lt Configure all child devices 1 Configure using the ISO 639 2 language specified by XXX f Force defaults v Validate options s Set options Type The type of default configuration options to force on the controller 0 Safe Defaults 1 Manufacturing Defaults 2 Custom Defaults 3 Performance Defaults DriverHandle The handle of the driver to configure DeviceHandle The handle of a device that DriverHandle is managing ChildHandle The handle of a device that is a c
2. Step is optional If step is not specified it will automatically be determined by the following tule if start lt end then step 1 otherwise step 1 Start end and step are divided by a space Examples Example 1 Sample for loop listing all txt files echo off for a in txt echo a exists endfor If there are two files named filel txt and file2 txt in the current directory the following will be the output of the sample script Samplel1 gt echo off filel txt exists file2 txt exists Theoretically it is legal for two nested for commands to use the same alphabet letter as their index variable for instance a Sample for loop from 1 to 3 with step 1 echo off for a run 1 3 echo a endfor Sample for loop from 3 down to 1 with step 1 echo off for a run 3 1 1 echo a endfor Example 2 1 0to7thRvw July 2005 33 EFI Shell User s Guide Batch Scripts Sample for loop 2 nested for using same index variable echo off for a in valuel value2 for a in value3 value4 echo a endfor endfor When processing the first for loop and before seeing the endfor the index variable a has the value valuel As a result in the second for loop the a has already been defined and will be replaced with the current value of a After substitution the string becomes for valuel in value3 value4 which is not a legal for command Thus the script will execute without e
3. dpath PNP Device Path for PnP HID A0341D0 UID 0x0 Hardware Device Path for PCI PNP Device Path for PnP HID 50141D0 UID 0 AsStr Acpi PNP0A03 0 Pci 1F 0 Acpi PNP0501 0 To display all handles with diskio protocol Shell gt dh p diskio Handle dump by protocol Diskio 15 DiskIo BlkIo DevPath i 3 1 Ata Secondary Master 16 DiskIo BlkIo DevPath 1 PCI 0 0 Scsi Pun0 Lun0O 44 DiskIo BlkIo Fs DevPath ABD0O 01C0 507B 9E5F8078F531 ESP 45 DiskIo BlkIo Fs DevPath i Pun0 Lun0O HD Part4 SigGO0 ESP 17 DiskIo B1lkIo DevPath PCI 3 1 Ata Primary Master To display all handles with Image protocol and break when the screen is full Shell gt dh p Image b Handle dump by protocol image 1 Image DXE Foundation 5 Image WinNtThunk 7 Image WinNtBusDriver DriverBinding 8 Image Metronome A Image IsaBus DriverBinding B Image WinNtConsole DriverBinding Shell gt 76 Commands 5 5 13 dir Summary Lists directory contents or file information EFI Versions EFI 1 02 and above Usage DIR r a attrib file r Displays recursively including subdirectories attrib a s h r d or combination of them a Archive s System h Hidden r Read only d Directory file Name of file directory wildcards are permitted Description This command lists directory contents or file information If no file name or directory name is specified then the
4. pause nsh gt echo pause nsh begin pause nsh begin pause nsh gt date 06 19 2001 pause nsh gt time 00 51 45 pause nsh gt pause Batch Scripts command Enter q to quit any other key to continue pause nsh gt echo pause nsh done pause nsh done To execute the script with echo off fs0 gt echo off fs0 gt pause nsh pause nsh begin 06 19 2001 00 52 50 Enter q to quit any other key to continue fs0 gt Shell gt 38 Batch Scripts The following script is a sample of pause q command fs0 gt type pause nsh File fs0 pause nsh Size 207 Example script for pause command echo pause nsh begin date time pause q echo pause nsh done To execute the script with echo on fs0 gt pause nsh pause nsh gt echo pause nsh begin pause nsh begin pause nsh gt date 06 19 2001 pause nsh gt time 00 51 45 pause nsh gt pause q pause nsh gt echo pause nsh done pause nsh done To execute the script with echo off s0 gt echo off fs0 gt pause nsh pause nsh begin 06 19 2001 00 52 50 pause nsh done s0 gt Shell gt 4 2 6 shift NoTE This command is available only in batch script files Summary Shifts the arguments from 0 to 39 one by one 1 0to7thRvw July 2005 39 EFI Shell User s Guide Batch Scripts Usage shift Description The shift command increases the number of positional parameters to more than the
5. Directory name wildcards are permitted Description This command displays and sets the attributes of files or directories The following four attribute types are supported in the EFI file system e Archive A e System S e Hidden H e Read only R If a file in general meaning is a directory then it is also shown to have the attribute D If any file in the file list that is specified in the command line does not exist attrib will continue processing the remaining files while reporting the error 54 Commands Examples Shell gt help attrib Displays or changes the attributes of files or directories ATTRIB ta a s s th h r r file directory t ta a Sets or clears archive attribute s s Sets or clears system attribute h h Sets or clears hidden attribute r r Sets or clears read only attribute file File name wildcards are permitted directory Directory name wildcards are permitted Notes 1 If no attribute option is specified in the parameters the command simply displays the attributes of specified files or directories 2 If no file or directory is specified in the command line arguments then the command applies to all the files and directories within the current directory Examples To display the attributes of a directory fs0 gt attrib fs0 attrib D fs0 To add the system attribute to all files of extension efi fs0 gt att
6. Dumps information using the ISO 639 2 language specified by lang v Dumps verbose information on specified handle Note 1 When neither handle nor prot_id is specified a list of all the handles in the EFI environment is displayed 2 Option d can be used to display EFI Driver Model related information including its parent handles child handles all drivers on it etc 3 Option v can be used to display verbose information on the specified handle including all the protocols on it and their details 4 If option p is specified all handles containing the specified protocol will be displayed Otherwise the handle parameter has to be specified for display In this case option d will be enabled automatically if option v is not specified Examples To display all handles and display one screen at a time Shell gt dh b Handle dump 1 Image DXE Foundation 2 FwVol FwFileSys FwVolBlk DevPath MemMap 11 1B50000 1D4FFC8 3 Image Ebc DevPath MemMap 11 1CA0000 1CB0000 Image WinNt Thunk WinNtThunk DevPath 76F3 11D4 BCEA 0080C73C8881 Image WinNtBusDriver DriverBinding NH UO 1 0to7thRvw July 2005 75 EFI Shell User s Guide Commands To display the detailed information on handle 0x30 Shell gt dh 30 Handle 30 01AF5308 IsaIo ROM Size 00000000 ROM Location 00000000 ISA Resource List IO 000003F8 000003FF Attr 00000000 INT 00000004 00000000 Attr 00000000
7. EFI 1 10 and above EFI 1 02 and above EFI 1 02 and above Commands Displays a list of files and subdirectories Disconnects one or more drivers from a device Displays a list of drivers that follow the EFI Driver Model Invokes the Driver Configuration Protocol Invokes the Driver Diagnostics Protocol Displays messages or turns command echoing on or off Exits the EFI Shell Displays the list of commands or verbose help of a command Loads EFI drivers Displays a list of files and subdirectories Displays or defines mappings Creates one or more directories Moves one or more files directories to a destination Disconnects a driver from a device and then connects it again Resets the system Deletes one or more files or directories Displays creates changes deletes environment variables Displays the current time or sets the time of the system Updates the time with the current time Displays the contents of a file Unloads a protocol image Displays the version information Displays volume information of the file system k NoTE This command is an internal only command it cannot be switched to an external command or application The indentation spacing or line breaks that are used in the command descriptions in this section are optimized for viewing the documentation They might not always match what is in the EFI Shell product itself All of the syntax in these command descriptions is only for enhanced
8. The EFI Shell will store the output of commands that have been executed Press the Page Up and Page Down buttons to browse through the screen history which is also called the scroll back buffer You can view a maximum of three screens of output history 6 19 How to Redirect the Output of Commands to Files The EFI Shell supports redirecting the standard output and the standard error output of commands to files See Output Redirection in the Syntax chapter for the redirection flags that you can use to perform output redirection When performing a redirection put the command and all of its arguments on the left side of the redirection flags You can redirect one standard output and one error output on the command line at a time but the redirection files should be different You cannot put multiple standard output flags and multiple error output flags on the command line either 6 20 How to View the Contents of a Text File Use the type command to view the contents of a text file This command is similar to the MS DOS command type and the Unix command cat See the Commands chapter for the detailed help information for the type command 6 21 How to Edit a Text File An edit application is provided along with the EFI Shell to allow users to edit text files This application provides a simple editor environment to create and edit text files To launch the edit application type the following at the command prompt edit 6 22 How t
9. gt test testl ok moving fs0 test2 gt test test2 ok Moving a read only directory will result a failure fs0 test gt attrib r temp1 DA R s0 test templ fs0 test gt mv templ temp2 moving fs0 test templ gt test temp2 error Invalid Parameter Shell gt 5 5 26 reconnect NoTE This command is an internal only command It cannot be switched to an external command Summary Reconnects drivers to the specific device EFI Versions EFI 1 10 and above 112 Commands Usage RECONNECT DeviceHandle DriverHandle ChildHandle RECONNECT r DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always taken as hexadecimal number ChildHandle Child handle of device always taken as hexadecimal number r Reconnect drivers to all devices Description This command reconnects drivers to the specific device It will first disconnect the specified driver from the specified device and then connect the driver to the device recursively If the r option is used then all drivers will be reconnected to all devices See the connect and disconnect commands for more details The example below is the typical output from the help for this command 1 0to7thRvw July 2005 113 EFI Shell User s Guide Commands Examples Shell gt Help Reconnect Reconnects one or more drivers from a device RECONNECT DeviceHandle DriverHandle ChildHandle RECONNECT
10. 02 EFI Vendor INTEL EFI Revision 12 38 SAL Specification Revision 3 0 SAL_A Revision 1 1 SAL_B Revision 1 1 PAL_A Revision 66 23 PAL_B Revision 66 23 Other modules mentioned in FIT Firmware Interface Table FIT_Entry Type 0 Revision 2 60 FIT_Entry Type 15 Revision 66 23 FIT_Entry Type 16 Revision 0 90 FIT_Entry Type 32 Revision 0 30 FIT_Entry Type 30 Revision 1 0 FIT_Entry Type 17 Revision 0 90 FIT_Entry Type 18 Revision 6 0 FIT_Entry Type 20 Revision 0 80 SalProc Entry 000000003FE3F720 and GP 000000003FF22480 PalProc Entry 000000003FF48010 IO Port Base 00000FFFFC000000 Cache Enabled To display the version information of the EFI Shell Shell gt ver s EFI Shell Revision 1 0 130 Commands EFI Shell Signature D2C18636 40E5 4EB5 A31B 36695FD42C87 Shell gt 5 5 35 vol Summary Displays the volume information for the file system that is specified by fs EFI Versions EFI 1 02 and above Usage VOL fs n lt Volume Label gt VOL fs d fs The name of the file system Volume Label New volume label d Empty volume label Description This command displays the volume information for the file system that is specified by fs If fs is not specified the current file system will be taken as the correct fs If Volume Label is specified then the volume label for s will be set to Volume Label The maximum length for Volume Label is 11 characters 1 0to7thRvw July 2005
11. 131 EFI Shell User s Guide Commands Examples Shell gt help vol Displays volume information for the file system specified by fs VOL fs n lt Volume Label gt VOL fs d fs The name of the file system Volume Label New volume label d Empty volume label Notes 1 2 3 as The following characters cannot be used in Volume Label Pee ee Py laz Tes No space is allowed in Volume Label If fs is not specified the current file system will be taken fs Examples To display the volume of the current fs fs0 gt vol Volume has no label rw 1 457 664 bytes total disk space 1 149 440 bytes available on disk 512 bytes in each allocation unit To change the label of fs0 shell gt vol fs0 n help test Volume HELP_TEST rw 1 457 664 bytes total disk space 1 149 440 bytes available on disk 512 bytes in each allocation unit To get rid of the label of fs0 fs0 gt vol fs0 d Volume has no label rw 1 457 664 bytes total disk space 220 160 bytes available on disk 512 bytes in each allocation unit Shell gt 132 6 Shell How To s 6 1 Introduction This section provides instructions on how to perform various tasks in the EFI Shell These tasks include the following e How to Switch an External Command to an Internal Command e How to Switch an Internal Command to an External Command e How to Understand Consistent Mapping e How to Switch the Running Modes of the EFI Shell e How to Corre
12. BCFA 0080C73C8881 b1lkO UnknownDevice Alias f4 fs0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 To display all the mapped names that start with f Shell gt map f Device mapping table 4 UnknownDevice Alias fs0 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 fs0 UnknownDevice Alias 4 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 1 0to7thRvw July 2005 107 EFI Shell User s Guide Commands 5 5 24 mkdir Summary Creates one or more new directories EFI Versions EFI 1 02 and above Usage MKDIR dir dir dir Name of a directory to be created wildcards are not allowed Description This command creates one or more new directories Examples 108 Shell gt help mkdir Creates one or more directories MKDIR dir dir Commands dir Name of a directory to be created wildcards are not allowed Note 1 The parent directory must already exist 2 If the directory already exists it will fail to make such a directory 3 The directories in the command line should not rely on the creation of other directories in the command line For example mkdir new new test is not allowed 4 Redirecting output to a file that exists under the directory specified on the command line i
13. E ES 118 5 530 IME m E E E 121 3d TOUCH E SE E EAE EET ETA E S E T E E AE 122 PSE AV 0 EE E E A E T E A E 124 55 33 S0 a Le To AR vind Gaede EE E TE EE 127 oR aT Ta E EEE EE E E E E E E 129 5539 Volpe E masnnea an abaieats 131 6 Shell HOW TOS Aiii a a ets aaa iaaa a aaa aaa ir 133 Geli Nodu CON ives s ses sasives n ae e R aaa EA E EE R E A ERa RERE 133 6 2 How to Switch an External Command to an Internal Command cccceeeeee 133 6 3 How to Switch an Internal Command to an External Command 00ecceeeeeeeees 134 6 4 How to Understand Consistent Mapping cccccceceeeeeeeeeeeeeeeeeeeeeeeeeeeseaeeeeeeseaaeeees 135 6 5 How to Switch the Running Modes of the EFI Shell 0 ccceeeeeeeeeeeeeeeeneeeeeeseneeees 135 6 6 How to Correctly Write Scripts in the New EFI Shell 0 cc ccecceeeeeeeeseeeeeeeesteeees 136 6 7 How to Start a Specific startup nsh File When Launching EFI Shell eee 136 6 8 How to Understand the Use of Quotation MarkS cccccccececesssseeeeeeeeeessseeeeeeeeeeeeees 137 6 9 How to Understand the Use of the Escaping Character cccecceeesteeeeeeeeneeees 138 6 10 HOW OVAIIAS roters e E A EE AE EESE EEA aa ata EEEIEE 139 6 11 How to Map a File System to a User Specific Mapping Name csccceeceeeeees 139 6 12 How to Set Modify Delete Environment Variables ccccceeceeeeeeeeeeeeeeneeeeeeeseeeees 139 6 13 How to Launch and Exit t
14. EFI Shell The EFI Shell is designed to run on all EFI implementations that conform to version 1 02 or higher of the EFI Specification As a result it should be able to run on the following implementations without any modifications e EFT 1 02 e EFT 1 10 e Intel Platform Innovation Framework for EFI hereafter referred to as the Framework However some Shell commands and applications are not supported in all implementations and may not work on all implementations The Summary of Shell Internal Commands topic and the description of each individual command see the Commands chapter indicate the versions of EFI with which the command can be used 1 0to7thRvw July 2005 19 EFI Shell User s Guide Features 2 3 14 Running Modes and Backward Compatibility Support This version of the EFI Shell has two running modes e Backward compatible mode e Enhanced Shell mode In backward compatible mode users can run old Shell scripts old Shell commands with old syntax and part of the old Shell application without modification or recompiling In enhanced Shell mode the Shell runs with more new features and is not completely compatible with old versions of the EFI Shell This latest version of the EFI Shell uses a reserved volatile environment variable efishellmode to control and indicate the mode in which the Shell is running See Special Shell Variables in the Syntax chapter for more information on this variable By default the EFI
15. batch file If no argument is given the current on or off status is displayed The second form prints the given message to the display 92 Commands Examples Shell gt help echo Displays a message or turns command echoing on or off in batch files ECHO on off ECHO message on Displays when reading command lines from batch files off Does not display when reading batch command lines message Displays a message string Note 1 Echo off means to not display the command line when reading from batch files This command is not like the MS DOS echo 2 Echo without a parameter shows current echo setting Examples To display a message string of Hello World fs0 gt echo Hello World Hello World To turn command echoing on fs0 gt echo on To execute HelloWorld nsh and display when reading lines from the batch file fs0 gt HelloWorld nsh HelloWorld nsh gt echo Hello World Hello World To turn command echoing off fs0 gt echo off To display the current echo setting fs0 gt echo Echo is off Shell gt 1 0to7thRvw July 2005 93 EFI Shell User s Guide Commands 5 5 19 exit NoTE This command is an internal only command It cannot be switched to an external command Summary Exits the EFI Shell environment and returns control to the parent that launched the EFI Shell EFI Versions EFI 1 02 and above Usage EXIT Description This command exits the EFI
16. connect to any devices However if without the option the newly created device handles will not be further bound to any drivers 3 If no DriverHandle parameter is specified all matched drivers will be bound to the specified device 4 If no DeviceHandle parameter is specified all device handles in the current system will be the default 5 If only a single handle is specified and the handle has an EFI_DRIVER_BINDING_ PROTOCOL on it then the handle is assumed to be a driver handle Otherwise it is assumed to be a device handle 1 0to7thRvw July 2005 61 EFI Shell User s Guide Commands 6 If nothing is specified then all proper drivers will be tried to bind to all the devices without recursion Each connection status will be dumped 7 Output redirection is not supported for connect r usage Examples To connect all drivers to all devices recursively Shell gt connect r To display all connections Shell gt connect ConnectController 1 Status Success ConnectController 2 Status Success ConnectController 3 Status Success ConnectController 3D Status Success To connect driver 0x17 to all the devices it can manage Shell gt connect 17 To connect all possible drivers to device 0x19 Shell gt connect 19 To connect driver 0x17 to device 0x19 Shell gt connect 19 17 To connect console devices described in the EFI Environment Variables Shell gt connect c Shel
17. diag fs1 efil 1 diag To delete an environment variable Shell gt set d diagnosticpath Shell gt set path To change an environment variable fs0 gt set src efi fs0 gt set path f s0 efi tools fs0 efi boot fs0 srce efi fs0 gt set sre efil 1 fs0 gt set path fs0 efi tools fs0 efi boot fs0 120 Commands sre efil l To append an environment variable Shell gt set path Z 4 Shell gt set path path fs0 efi tools s0 efi boot fs0 Shell gt set path s0 efi tools fs0 efi boot fs0 To set a volatile variable that will disappear at the next boot Shell gt set v EFI_SOURCE c project EFI1 1 Shell gt set path s0 efi tools fs0 efi boot fs0 EFI_SOURCE c project EFI1 1 Shell gt 5 5 30 time Summary Displays or sets the current time for the system EFI Versions EFI 1 02 and above Usage TIME hh mm ss hh Hour of time Hour range 0 23 mm Minute of time Minute range 0 59 ss Second of time Second range 0 59 Description This command displays or sets the current time for the system If no parameters are used it shows the current time If valid hours minutes and seconds are provided then the system s time will be updated Note the following rules 1 Except for numeric characters and the character all other characters in the argument are invalid The Shell will report an error if the number is in the w
18. errors to multiple files NUL is used as a special output file name When NUL is used the output will not be written into a file Instead it is discarded silently 1 0to7thRvw July 2005 29 3 8 EFI Shell User s Guide Syntax File Naming Conventions This version of the EFI Shell supports only the FAT file system All file and directory naming conventions are compatible with the FAT file system specification The following FAT versions are supported e For system partitions FAT32 e For removable media FAT12 and FAT16 Both short and long names are supported The maximum valid length for a file or directory name is 255 characters According to conventions the following characters cannot be used in a file or directory name ex e lt e gt e e e W 30 4 Batch Scripts 4 1 Introduction This chapter describes batch scripts and the batch script only commands in more detail Specifically it provides detailed descriptions of all batch script commands also known as script only commands and discusses the following e Performing variable argument and alias substitution in batch script files e Using comments in batch script files e Handling errors in batch scripts e Handling running modes in batch scripts e Nesting the execution of batch script files e Redirecting the output of batch script files e Echoing commands in batch scripts to the console e Known limitations with the scripting language in b
19. in manufacturing and child devices that are mode mode mode mode mode on on on on on all devices all devices all devices all devices all devices in in and child mode on all devices Shell gt drvdiag m To run diagnostics in standard mode driver 0x17 Shell gt drvdiag s 17 To run diagnostics in standard mode driver 0x17 Shell gt drvdiag s 17 28 To run diagnostics in standard mode device 0x28 managed by driver 0x17 Shell gt drvdiag s 17 28 c To run diagnostics in standard mode device 0x28 managed by driver 0x17 Shell gt drvdiag s 17 28 30 Shell gt 5 5 18 echo NoTE on on on on Commands all devices managed by device 0x28 managed by all child devices of child device 0x30 of This command is an internal only command It cannot be switched to an external command Summary Controls whether or not batch commands are displayed as they are read from the batch file and prints the given message to the display EFI Versions EFI 1 02 and above 1 0to7thRvw July 2005 91 EFI Shell User s Guide Commands Usage ECHO on off ECHO message on Displays when reading command lines from batch files off Does not display when reading batch command lines message Displays a message string Description The first form of this command controls whether or not batch commands are displayed as they are read from the
20. myarg2 endif if smyvar runboth then myscriptl myscript2 else echo myvar S runboth endif In this example if the script file myscript nsh exists in sO then this script will be launched with the following two arguments e myargl e myarg2 The environment variable smyvar is then checked to see if its value is runboth If it is the scripts myscript1 andmyscript2 will be executed one after the other otherwise the following message is printed smyvar runboth 4 2 5 pause NoTE This command is available only in batch script files Summary Prints a message to the display and then suspends batch file execution and waits for keyboard input 36 Batch Scripts Usage pause q Description The pause command prints a message to the display and then suspends the execution of the batch file and waits for keyboard input Pressing any key except for q or Q resumes execution of the script If q or Q is pressed batch processing terminates otherwise execution continues with the next line after the pause command The q switch is optional and hides the message 1 0to7thRvw July 2005 37 EFI Shell User s Guide Examples The following script is a sample of pause fs0 gt type pause nsh File fs0 pause nsh Size 204 Example script for pause command echo pause nsh begin date time pause echo pause nsh done To execute the script with echo on fs0 gt pause nsh
21. s To copy a file in the same directory but change the file name fs0 gt copy temp txt readme txt copying fs0 temp txt gt fs0 readme txt ok To copy multiple files to another directory fs0 gt copy temp txt isaBus efi test copying fs0 temp txt gt fs0 test temp txt ok copying fs0 isaBus efi gt fs0 test IsaBus efi ok To copy multiple directories recursively to another directory fs0 gt copy r test1 test2 boot test copying fs0 testl gt fs0 test testl copying fs0 testi test1l txt gt fs0 test test1 testl1l txt ok copying fs0 test2 gt fs0 test test2 copying fs0 test2 test2 txt gt fs0 test test2 test2 txt ok copying fs0 boot gt fs0 test boot copying fs0 boot shell efi gt fs0 test boot shell efi ok To see the results of the above operations fs0 gt 1s test Directory of fs0 test 06 18 01 01 01p lt DIR gt 512 06 18 01 01 01p lt DIR gt O as 01 28 01 08 21p lt DIR gt 512 testi 01 28 01 08 21p lt DIR gt 512 test2 01 28 01 08 21p lt DIR gt 512 boot 01 28 01 08 23p 29 temp txt 01 28 01 08 23p 28 739 IsaBus efi 2 File s 28 828 bytes 5 Dir s Shell gt 1 0to7thRvw July 2005 65 EFI Shell User s Guide Commands 5 5 9 cp Summary Copies one or more source files or directories to a destination EFI Versions EFI 1 02 and above Usage CP r q sre srce dst r Recursive copy q Quiet copying repl
22. seatagelatnasd Fassbbieek eucsieteeres 14 Figure 3 1 Variable and Argument Substitution FIOWChart ccccceeeeeeeeeeeeeeeteeeeeeteeeeeesenaes 26 Table Table 1 1 Organization of This Document esis croc cesses tad hemnibaninien nesinemeaeeeinds 9 Table 2 1 Types of Commands Available in the EFI Shell c ccccccceccsessssteeeeeeeeeeeeees 15 Table 2 2 EFI Shell Command Help Information Level cc ccecceeeeeeeeeeeeeeeeeeeeeeeeeeeneeeeeees 19 Table 3 1 Special Characters in the EFI Shell scccccccccesessesseceeeeeeeesssssnesneeeeeeeeseees 22 Table 3 2 Index and Positional Variables ccccceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeseeeseeeeeeeeeeeeesees 24 Table 3 3 Special Shell Variables isiccccissscissivtsesetincatanewvedectingesvntereacaviinolddaatorusteiaadeensinenalevens 24 Table 3 4 Wildcard Character Expansion ccceceessseeeeeeeeeeeeeeeeeeaeeeeeeeaeeeeeeeeeeaeeseneeeeees 27 Table 3 5 Output Redirection Syntax setedeis secs ctctattel eel tin Mined arte erie 29 Table 4 1 EFI Shell Batch Script Commands cccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeenaeeeees 31 Table 4 2 Additional Information on RUNNING MOdES cee eee e etter eeeeeeanaeeeeeeeeeeeeees 44 Table 5 1 EFI Shell Protocol Information Table ccc cccccccccecesssessceeeeeeeeeeesesessneeeeeeeeeeees 46 Table 5 2 MS DOS 6 22 and Unix Equivalents for Shell Internal Commands 5 48 Table 5 3 EF
23. standard ten for use Examples Following script is a sample of shift command fs0 gt type shift nsh File fs0 shift nsh Size 79 Example script for shift command echo 1 2 3 shift echo 1 2 To execute the script with echo on fs0 gt shift nsh welcome EFI world shift nsh gt echo welcome EFI world Welcome EFI world shift nsh gt shift shift nsh gt echo EFI world EFI world To execute the script with echo off fs0 gt echo off fs0 gt shift nsh welcome EFI world welcome EFI world EFI world 4 3 Variable Argument and Alias Substitution 4 3 1 Variable Argument and Alias Substitution in Batch Scripts This section describes variable argument and alias substitution in batch scripts and covers the following e Alias Substitution Rule e General Variable Substitution Rule e General Command Line Variable Substitution Rule e Supported Number of Arguments e Syntax for Variables 40 Batch Scripts e Examples The rules that are described in this section are true only in enhanced Shell mode 4 3 2 Alias Substitution Rule in Batch Scripts NoTE This rule is true only in enhanced Shell mode In batch scripts only the first argument on the command line can be an alias No other arguments will be interpreted as an alias Substitution of aliases is not recursive 4 3 3 General Variable Substitution Rule in Batch Scripts NoTE This rule i
24. switched to an external command Summary Disconnects one or more drivers from the specified devices EFI Versions EFI 1 10 and above 1 0to7thRvw July 2005 79 EFI Shell User s Guide Commands Usage DISCONNECT DeviceHandle DriverHandle ChildHandle DISCONNECT r DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always taken as hexadecimal number ChildHandle Child handle of a device always taken as hexadecimal number r Disconnect drivers from all devices Description This command disconnects one or more drivers from the specified devices If the r option is used all drivers are disconnected from all devices in the system The following example is the typical output from the help for this command 80 Commands Examples Shell gt help disconnect Disconnects one or more drivers from a device DISCONNECT DeviceHandle DriverHandle ChildHandle DISCONNECT r DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always taken as hexadecimal number ChildHandle Child handle of a device always taken as hexadecimal number r Disconnect drivers from all devices Notes 1 If option r is used all drivers will be disconnected from all devices in the system In this case no other parameters are allowed to be used together 2 If no ChildHandle parameter is specified the default is to disconnect all c
25. to reset service Description This command resets the system The default is to perform a cold reset unless the w parameter is specified If the reset st ring is specified then it is passed into the Reset function so the system can know the reason for the system reset 1 0to7thRvw July 2005 115 EFI Shell User s Guide Commands Examples Shell gt help reset Resets the system RESET w string RESET s string W Performs a warm reset s Performs a shutdown string String to be passed to reset service Note 1 Not all systems implement w flag This may mean different things depending on which BIOS EFI is implemented 2 Reset will be guaranteed to reset the chipset as well as the processor when cold reset is called 3 This command does not support output redirection Shell gt 5 5 28 rm Summary Deletes one or more files or directories EFI Versions EFI 1 02 and above Usage RM q file directory file directory q Quiet mode does not prompt user for a confirmation file File name wildcards are permitted directory Directory name wildcards are permitted Description This command deletes one or more files or directories If the target is a directory it will delete the directory including all its subdirectories It is not allowed to redirect a file whose parent directory or the file itself is being deleted 116 Commands Examples Shell gt help rm Deletes on
26. you want to specify a name for a certain file system by handle you can do so by typing the following at the command prompt map name handle See the Commands chapter for the detailed help information for the map command 6 12 How to Set Modify Delete Environment Variables Use the set command to set modify and delete environment variables Environment variables are variables that can be accessed at the command prompt or in batch scripts The EFI Shell currently only supports a string data type for all the environment variables See Valid Characters for Variable Names in the Syntax chapter for the characters that can be used to make variable names There is no limitation on the contents of variables To delimit an environment variable put the variable name inside a pair of percentage signs and the entire expression will be replaced by the content of the environment variable See the Syntax and Batch Scripts chapters for the detailed variable substitution rules To set a environment variable test whose content is hello type the following at the command prompt 1 0to7thRvw July 2005 139 EFI Shell User s Guide Shell How To s set test hello The EFI Shell also supports volatile environment variables For example to set a volatile environment variable GUT type the following at the command prompt set v GUI graphic world See the Commands chapter for the detailed help information for the set command 6 13 How to Lau
27. 080C73C8881 b1k0 Consist Name Other Name Handle Media Type Removeable Current Dir Device Path 0080C73C8881 106 4 fs0 b1k0 5F Fs DiskIo BlkIo WinNtDriverIo UnknownDevice NO VenHw 58C518B1 76F3 11D4 BCEA VenHw 0C95A92F A006 11D4 BCFA f4 b1k0 5F Fs DiskIo BlkIo WinNtDriverIo UnknownDevice NO VenHw 58C518B1 76F3 11D4 BCEA VenHw 0C95A92F A006 11D4 BCFA 4 fs0 5F Fs DiskIo BlkIo WinNtDriverIo UnknownDevice NO VenHw 58C518B1 76F3 11D4 BCEA Commands VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 To assign fsO another name Shell gt map floppy fs0 floppy UnknownDevice Alias 4 fs0 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 To display the information of the mapped name Shell gt map floppy floppy UnknownDevice Alias f4 fs0 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 To operate with the mapped name Shell gt floppy floppy gt 1s To delete a mapped name Shell gt map d floppy Shell gt map Device mapping table 4 UnknownDevice Alias fs0O b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 fs0 UnknownDevice Alias f4 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4
28. 6 Shell How To s 6 8 How to Understand the Use of Quotation Marks The quotation mark character is one of the special functional characters in the EFI Shell A single quotation mark character that is not paired with another closing quotation mark will be discarded after the command line is processed and will not cause any consequences The quotation mark pair has the following three main functions e Makes the input on the command line literal e Helps to group arguments on the command line e Specifies the boundaries for variable substitution Making the Input Literal Making the input literal means that none of the characters in the input will be treated as a special functional character In the EFI Shell any strings that start with a or character will be interpreted as flags to a command If you want to prevent them from being interpreted as flags you can use quotation marks to make them literal For example if you want to display the string dump you can use the following at the command prompt echo dump Here the quotation marks will prevent the string dump from being interpreted as a flag to the command echo NoTE You can also use the escaping character to make the input literal See How to Understand the Use of the Escaping Character for more information Grouping Arguments on the Command Line Because the EFI Shell interprets blank spaces as the splitting character to separate ar
29. AE ro re Or PC E re Pen oe OR Pee ree Pee 56 5 5 6 NS cheese cea ea aarti and ak a one a Mee Ge eae AT 58 5 5 7 CONNECT oera ted cnade laud a ENAA e eaa T canons ET A AA 59 5 5 8 COPY sevesedentiensvndagvavqent ee orr avaan aa sive toy seller PARN a TAE a E a coves 62 5 5 9 OPa n eh teat ate eee tee N E 66 BONO dalea tenia ded cakes ee eed E E decane ou dolar 69 BO PASM tale E a ee E AEE A EEE TTA E sent nat wean cas EE ES OE 70 KERE e E E cece tec EE EN EE E I E 73 vi COS Fa am eer A re er ere E 77 5 5214 lt CISCOMMO CK E eA EA as ot vas dace EEEE S E EA ceimecscencacweatevnctheanthcea dea adage 79 BSS CIVENS wesscdsseschees sivas TE teresa beaks aan ante AE 82 ooa Le Ee AVOA S serie asdterssctusdedests tacaeteneuverstuareasecaanadseucdnt inde aneaastaseverreeuseant sya seoededeats 84 5 5 17 CIV AG anenun ea gt ect acd heals doen waded A ea ad N E a Ea 88 BiB e gt SOMO EOE EA AEE E EE EE E E E E E erases dedmuenav envi aetvovents 91 o OME E E A eg iuiaa inant 94 S920 Helpa e a E E E ence a a N 94 aA NEEN OAC PEE EE TE E EAT 97 5522 o TG estat tie a a a wilted si Pasa a a a tein S 98 5 9 29 Map a earra ote eg a Apie Ra T AAIEN VEE a Wena ead T AAA vee ened 101 B52 LIK E E E T 108 oTM h Se A E A T A A A A E EE 110 Eo o 10 A a e E E gees ae cede ae A daaeadeaaecasenaanesgeeebean aes 112 Eo A E E E E tad te E E att Sem A tines 115 55 287 IN aeaea a E tere a aA Ea A ote wed Sees apa O EE 116 55 29 SEa E E EE E N E EN
30. EFI Shell User s Guide Draft for Review Version 1 0_to7thRvw July 7 2005 EFI Shell User s Guide Information in this document is provided in connection with Intel products No license express or implied by estoppel or otherwise to any intellectual property rights is granted by this document Except as provided in Intel s Terms and Conditions of Sale for such products Intel assumes no liability whatsoever and INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE MERCHANTABILITY OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT Intel products are not intended for use in medical life saving or life sustaining applications Intel may make changes to specifications and product descriptions at any time without notice This document contains information on products in the design phase The information here is subject to change without notice Do not finalize a design with this information Designers must not rely on the absence or characteristics of any features or instructions marked reserved or undefined Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them This document as well as the software described in it is furnished under license and may only be used or copied in accordanc
31. FARING ia neeurineon aden gid elaine iin eee cies aa E RR a 43 4 6 Running Modes in Baten Scripts vine ncdtetigeeeun onde lade ong 44 4 7 Nesting Batch Scripts sereen eao n r aa peir eaS EE AEREE AEA EEEa 44 4 8 Output Redirection in Batch Scripts sseseesesseeeserrnserrrrretrrrssttrnnertrnntesrrrnsserrnnnrennne 44 4 9 Echoing in Batch SOnIPIS 3 3 c2 2 ces mocscaceagndte iecut ehalieackatses tas weces Saad eccoudcbaasceteotesaaccteenekn te 45 4 10 Known Limitations with the Shell Scripting Language cc ceeeeeeeeeeeeeeeeeeeeeeeeeees 45 SB COMMANGS ae ae AEE E EEE EE eee eda need ee ee ea ee 46 Dek SUUPOGUCTIOM sexe iucad Pres E TE E T 46 5 2 Ext rmal Comma nas ais sient aol han a a a aa a a a 46 5 3 Supported EFI Protocols in the Shell s nsssssssesnnneessnrrnseeenrrrenresserrrnerrnnnresrtrrssrrrnne 46 5 4 MS DOS 6 22 and Unix Equivalents ccccecsceeeeeeseeeeeeeceeeeeeeeeeeeeeeeeeaeeeeeeaaeeeeens 48 5 5 Internal Command DeSCriptions ccceeeccceeeeeeceeeeeeeceeeeeeeeaeeeeeeeaeeeeseeseeeeeeeeeaaeeeeee 49 5 5 1 Summary of EFI Shell Internal Commands cc ccceeeeeeeeeeeeeeeeeeeeneeeeeeee 49 5 5 2 Command Usage Notes sak sces ccc ceeresetieiatn elder edd bedic a eobeamn cd eee 50 5 5 3 VAS cee ses teat senses Satay steed aha eden ocean eed Roa eee ae uate 51 5 5 4 GUID seek ices en inaani e a Ee o e Mis teans nlcadeheedplateatenacctaksbetaaustags Seabenenetee 53 SFL YS MRE OR te E
32. I Shell Internal COMMANAS cccccccecssssensceeeeeeeeesseeennnaeeeeeeeeesesseeneeeeeeeeeees 49 Table 5 4 Conventions for Directory NameS cccccceceeeeseeeeeeeeeneeeeeeeeeeeeeeeseeaeeeeeesaaeeeeeas 56 Table 5 5 Default Values for the Type Parameter 0 ccceeeseseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 85 Table 6 1 Examples of Custom Aliases cccccccceeeeeeeeeeeeeseeeeeeeceeeeeeeecneeeeeteneeeeeeeenaaeees 139 Vili 1 1 1 2 1 3 1 Introduction Overview This document the EFI Shell User s Guide is the end user s manual for the EFI Shell The EFI Shell is a special EFI application that allows batch scripting EFI Shell commands and other EFI Shell applications to be launched This document is organized as listed in the table below Table 1 1 Organization of This Document Book Description Introduction Provides definitions of terms that are used in this document and information on references that are mentioned It also describes the typographic conventions that are used in this specification Features Describes the features of the EFI Shell It introduces Shell commands batch scripts PATH variable support KEY history support verbose help support and other Shell features Syntax Introduces the required syntax for commands and batch scripts in the EFI Shell Batch Scripts Lists all batch script commands that are available in the EFI Shell Commands Lists all the internal core comman
33. Shell environment and returns control to the parent that launched the EFI Shell Examples Shell gt help exit Exits the EFI Shell environment and returns control to its parent EXIT Examples Shell gt exit 5 5 20 help NoTE This command is an internal only command It cannot be switched to an external command Summary Displays the list of commands that are built into the EFI Shell EFI Versions EFI 1 02 and above 94 Commands Usage HELP cmd pattern cmd Shell command pattern Wildmatch pattern Description The help command displays the list of commands that are built into the EFI Shell It also supports displaying the verbose help information for a specified command You can also use cmd to display the verbose help of a command where cmd is the name of the EFI Shell command or application This syntax does the same thing as help cmd and can be used for both internal and external Shell commands The form of help cmd however can be used only for internal Shell commands The following example shows the output from this command 1 0to7thRvw July 2005 95 EFI Shell User s Guide Commands Examples Shell gt help help Displays the list of commands or verbose help of a command in the EFI Shell HELP cmd pattern cmd Shell command pattern Wildmatch pattern Note 1 cmd also displays the verbose help of cmd the same as help cmd 2 If cmd has no verbose help its lin
34. Shell image was just launched If it cannot find the startup nsh file in that directory or if it was not launched from a file system it will search the execution path that is defined by the environment variable path Once the start up file commands in startup nsh have been executed the Shell looks for commands from a console input device When the shell starts it waits for 5 seconds then executes startup nsh Use the shell environment variable StartupDelay to set the waiting time 2 4 3 EFI Shell Prompt The Shell prompt which can also be called the Shell command prompt is the basic entry for users to do the following e Execute Shell commands e Load drivers e Execute EFI applications It displays one of the following prompt symbols on the screen and waits for user input fs0 gt or Shell gt All commands and applications are invoked by typing the name of the command at the Shell prompt In addition the active drive may be changed at the command prompt by typing the mapped name followed by a colon 1 0to7thRvw July 2005 21 3 Syntax Introduction This section provides information on the syntax to use with the EFI Shell In this context syntax means the general rules for what you can and cannot type at the command prompt and include in batch scripts It covers the following information e Special Characters e Variable and Alias Substitution e Wildcard Expansion e Switches and Arguments in Commands e Quotat
35. Shell mode 5 5 2 Command Usage Notes Note the following when using the Shell internal commands 1 Ifthe Handle parameter is required in the internal Shell command argument for example in the dh or disconnect command it actually indicates the handle index not the real handle For convenience the EFI Shell views the handle index as the equivalent of the real handle to operate an image handle device handle and so on As a result users should also use the handle 50 Commands index instead of the real handle value in Shell commands The handle index can change after some hardware changes or the execution of some commands such as disconnect connect reconnect To get the current handle index for the specified device driver or image use the dh command 2 Insome file operation related Shell commands such as load and attrib an argument is listed as File orDirectory inthe syntax The suffix here indicates that the arguments can be one or more files directories The command will process these arguments in the order in which they appear on the command line Any previous execution failures will not prevent the following commands from executing For example attrib h filel file2 file3 is a legal command and has the same execution results as the following command sequence 3 attrib h filel attrib h file2 5 attrib h file3 If any execution among them fails the next command will continue executing until all t
36. Shell will run in enhanced Shell mode See Running Modes in Batch Scripts in the Batch Scripts chapter for more information on setting running modes in batch scripts 2 4 Invoking the EFI Shell 2 4 1 Invoking the EFI Shell The EFI Shell is provided in two forms e As the built in EFI Shell eAs an efi image file of the EFI Shell In the first form the EFI Shell is built with the firmware and it can be a boot option In the second form the EFI Shell is provided as a file which users can load and run using either of the following methods e Through the menus in the EFI boot manager in EFI 1 10 or the Boot Maintenance Manager in the Framework e By executing the file at the EFI Shell command prompt 2 4 2 Start up Batch File Startup nsh When the EFI Shell is invoked it searches for a start up file named startup nsh and displays the following message Press ESC in 5 seconds to skip startup nsh any other key to continue 20 Features Startup nsh is a batch script file that contains Shell commands that will be executed when the Shell starts Press the ESC key within five seconds to prevent startup nsh from executing Press any other key to immediately execute startup nsh See Shell Appearance for a screen shot of this prompt Startup nsh is not a required file and does not have to exist If the Shell was launched from a file system it first looks for the startup nsh file in the same directory from which the
37. aDraw Ugalo UnicodeCollation 1 0to7thRvw Commands Bus Specific Driver Override Protocol Component Name Protocol Driver Configuration Protocol Console in Device Console out Device Debugport Protocol Debug Support Protocol Decompress Protocol Device I O Protocol Driver Diagnostics Protocol Disk I O Protocol Device Path Protocol Driver Binding Protocol Error out Splitter Protocol Simple File System Protocol Loaded Image Protocol ISA ACPI Protocol ISA I O Protocol Legacy Boot Protocol Load File Protocol Simple Network Protocol Network Interface Identifier Protocol PCI I O Protocol PCI Root Bridge I O Protocol PXE Base Code Protocol SCSI I O Protocol SCSI Pass Thru Protocol Serial I O Protocol Simple Pointer Protocol Standard Error Device TCP Protocol Simple Text in Protocol Text in Splitter Protocol Simple Text Output Protocol Text out Splitter Protocol UGA Draw Protocol UGA I O Protocol Unicode Collation Protocol July 2005 47 EFI Shell User s Guide Commands Usblo USB I O Protocol VgaClass VGA Class Driver Protocol 5 4 MS DOS 6 22 and Unix Equivalents The following table lists the equivalent command names for internal EFI Shell commands and MS DOS 6 22 and Unix commands Table 5 2 MS DOS 6 22 and Unix Equivalents for Shell Internal Commands EFI Shell Command MS DOS 6 22 Equivalent Unix Equivalent alias alias attrib attrib chmod cd cd cd cls cls clear connect copy copy c
38. ace existing files without prompt src Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Description This command copies one or more source files or directories to a destination If the source is a directory the r flag must be specified If r is specified then the source directory will be recursively copied to the destination which means that all subdirectories will be copied If a destination is not specified then the current working directory is assumed to be the destination If any target file not directory already exists there will be a prompt asking the user to confirm replacing the file The following four choices are available e Yes Replace the file eNo Do not replace the file e All Replace the existing files in all subsequent cases eCancel Do not replace any existing files in all subsequent cases If there are multiple source files directories the destination must be a directory 66 Commands Examples Shell gt help cp Copies one or more files directories to another location CP r q sre srce dst r Recursive copy q Quiet copying replace existing files without prompt src Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Note 1 r must be specified if src is a directory If r is specified then the source directory will b
39. arts in the following argument which are abc 1 and def respectively abc 1 def The introduction of a part helps to avoid ambiguity in the variable substitution process Variable substitution will be performed within a single part and cannot be performed across the boundary of any two adjacent parts As a result a S1 b is completely different from a 1 b for variable substitution In a command line the EFI Shell will treat an argument that begins with a or character as a flag option and it will be specially interpreted As a result to prevent an argument from being interpreted as a flag a string starting with a or character must be enclosed by a pair of quotation marks For example in the following command line the argument b will not be interpreted as a flag alias more b As an alternate approach you can use the escaping character to prevent an argument that starts with a or character from being interpreted as a flag option For example if you type echo d at the command prompt d is interpreted as a string and not as a flag and the string d will be displayed instead of an error message that the flag d is unknown 28 Syntax 3 7 Output Redirection The output of EFI Shell commands can be redirected to files The following is the syntax for this redirection Command gt unicode_output_file_pathname Command gt a ascii_output_file_pathname Command 1 gt unicode_output_file_pathname Comman
40. atch scripts See the Batch Scripts topic in the Features chapter for introductory information on batch scripts All EFI Shell command syntax that was described in the Syntax chapter applies to EFI Shell batch scripts Note that the Shell does not save commands that are executed from a batch script for the KEY history up arrow command recall 4 2 Batch Script Command Descriptions 4 2 1 Summary of Batch Script Commands The table below lists the script only commands The following topics describe the EFI Shell batch script commands in detail Table 4 1 EFI Shell Batch Script Commands Command Description for endfor Executes commands for each item in a set of items goto Makes the execution of the batch file jump to another location if else endif Executes commands in specified conditions pause Prints a message and suspends for keyboard input shift Shifts the arguments from 0 to 9 one by one 31 EFI Shell User s Guide Batch Scripts NoTE The indentation spacing or line breaks that are used in the script command descriptions in this section are optimized for viewing the documentation They might not always match what is in the EFI Shell product itself 4 2 2 for endfor NoTE This command is available only in batch script files Summary Executes one or more commands for each item in a set of items Usage for indexvar in set command arguments command arguments endfor
41. ath The relative or absolute file path Note 1 Type CD without parameters to display the current fs and directory 2 The path parameter can contain some special usage When or is used as a directory means the current directory and means its parent directory can also be used at the beginning of the path to represent the root of the current driver mapping 3 CD shall be used in the same volume 4 CD can change the current directory in the file system other than current file system 5 There must be at least one blank space between CD and path Examples To change the current fs to the mapped fs0 Shell gt fs0 To change the current directory to subdirectory efi f s0 gt cd efi To change the current directory to the parent directory s0 fs0 efi gt cd To change the current directory to fs0 efi tools fs0 gt cd efi tools To change the current directory to the root of the current fs fs0 fs0 efi tools gt cd fs0 gt To move between volumes and maintain the current path fs0 gt cd efi tools fs0 efi tools gt fs1 fs1 gt cd tmp fs1 tmp gt cp fs0 1 0to7thRvw July 2005 57 EFI Shell User s Guide Commands Shell gt 5 5 6 cls Summary Clears the standard output device with an optional background color attribute EFI Versions EFI 1 02 and above Usage CLS color color New background color Black Blue Green Cya
42. ation of EFI that has been designed to perform the full range of operations that are required to initialize the platform from power on through transfer of control to the operating system See Related Information from Intel Corporation in the EFI Documentation help system for more information Shell The EFI Shell is a simple interactive environment that allows EFI device drivers to be loaded EFI applications to be launched and operating systems to be booted 1 4 Conventions Used in This Document 1 4 1 Command Descriptions The commands that are described in this document generally have the following format Command N ame The formal name of the command Summary A brief description of the command EFI Versions Indicates the versions of EFI with which the command can be used Usage A brief usage of the command Description A detailed description about how to use that command Examples Examples to show how to use that command 10 Features 1 4 2 Pseudo Code Conventions Pseudo code is presented to describe algorithms in a more concise form None of the algorithms in this document are intended to be compiled directly The code is presented at a level corresponding to the surrounding text In describing variables a list is an unordered collection of homogeneous objects A queue is an ordered list of homogeneous objects Unless otherwise noted the ordering is assumed to be First In First Out FIFO Pseudo code
43. copying replace existing files without prompt src Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Note 1 r must be specified if src is a directory If r is specified then the source directory will be recursively copied to the destination Src itself will be copied 2 If dst parameter is not specified then the current directory is assumed to be the destination 3 COPY r srcl src2 dst is to copy all files and subdirectories in srcl and src2 to the destination dst Srcl and src2 themselves are also copied dst parameter will be interpreted as a directory 4 Copying a directory file to itself is not allowed 5 If an error occurs COPY will exit immediately and the remaining files or directories will not be copied 6 When copy is executed with a script file it always performs quiet copying regardless of whether the q option is specified 7 If you are copying multiple files the destination must be an existing directory Examples To display the contents of current directory first of all fs0 gt 1s Directory of fs0 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 testl 06 18 01 01 02p lt DIR gt 512 test2 06 13 01 10 00a 28 739 IsaBus efi 06 13 01 10 00a 32 838 IsaSerial efi Commands 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 3 File s 61 606 bytes 4 Dir
44. ctly Write Scripts in the New EFI Shell e How to Start a Specific startup nsh File When Launching EFI e How to Understand the Use of Quotation Marks e How to Understand the Use of the Escaping Character e How to Alias e How to Map a File System to a User Specific Mapping Name e How to Set Modify Delete Environment Variables e How to Launch and Exit the EFI Shell e How to Determine the Version of the EFI Shell e How to Get Help Information e How to Terminate the Execution of Commands e How to Pause the Screen Output e How to View the Screen History e How to Redirect the Output of Commands to Files e How to View the Contents of a Text File e How to Edit a Text File e How to Edit a Binary File e How to Edit Disk Blocks e How to Edit Memory e How to Connect a Driver to a Device 6 2 How to Switch an External Command to an Internal Command The following steps explain how to switch an external command to an internal command 1 You should put all the files of your external command or application under a subdirectory of the EFI Shell source root directory in the release package For example if the EDK root directory is C EDK you should put your source code directory under C EDK Other Maintained Application Shel11 e g C EDK Other Maintained Application Shell1 Hello 133 6 3 1 2 EFI Shell User s Guide Shell How To s Add line
45. current directory is assumed The contents of a directory are listed if all of the following are true elf option r is not specified e If no wildcard characters are specified in the file parameter elf file represents an existing directory In all other cases the command functions as follows e All files directories that match the specified name are displayed e The r flag determines whether a recursive search is performed e The option flag a attrib tells the command to display only those files with the attributes that are specified by attrib If more than one attribute is specified only the files that have all those attributes will be listed If a is followed by nothing then all files directories are displayed regardless of their attributes If a itself is not specified then all files except system and hidden files are displayed 1 0to7thRvw July 2005 71 EFI Shell User s Guide Commands Examples Shell gt help dir Displays a list of files and subdirectories in a directory DIR r al attrib file r Displays recursively including subdirectories attrib a s h r d or combination of them a Archive s System h Hidden r Read only d Directory file Name of file directory wildcards are permitted Examples To hide files by adding the hidden or system attribute to them fs0 gt attrib s th efi ASH fs0 IsaBus efi ASH fs0 IsaSerial efi To display all except the
46. d 2 value can be an internal Shell command a script or an EFI application However any other values are also acceptable 3 Alias values are stored in EFI NVRAM and will be retained between boots unless the flag v is specified 4 Alias should not succeed to add a non volatile alias when a same volatile alias exists or vice versa 52 Examples To display all aliases in the current EFI environment Shell gt alias md mkdir rd rm To create an Shell gt alias Shell gt alias md rd myguid To delete an Shell gt alias Shell gt alias md F rd alias to the EFI environment myguid guid mkdir rm guid alias in the EFI environment d myguid mkdir rm Commands To add a volatile alias in the current EFI environment which has a star at the line head This volatile alias will disappear at next boot Shell gt alias v fs0 floppy Shell gt alias md mkdir rd rm x fs0 floppy Shell gt 5 5 4 attrib Summary Displays and sets the attributes of files or directories EFI Versions EFI 1 02 and above 1 0to7thRvw July 2005 53 EFI Shell User s Guide Commands Usage ATTRIB tal a s s th h r r file directory a a Sets or clears archive attribute s s Sets or clears system attribute h h Sets or clears hidden attribute r r Sets or clears read only attribute file File name wildcards are permitted directory
47. d 1 gt a ascii_output_file_pathname Command 2 gt unicode_output_file_pathname Command 2 gt a ascii_output_file_pathname Command gt gt unicode_output_file_pathname Command gt gt a ascii_output_file_pathname Command 1 gt gt unicode_output_file_pathname Command 1 gt gt a ascii_output_file_pathname The table below describes the special character combinations that are used in the syntax above Table 3 5 Output Redirection Syntax Character Sequence Description gt Redirects standard output to a Unicode file gt a Redirects standard output to an ASCII file 1 gt Redirects standard output to a Unicode file 1 gt a Redirects standard output to an ASCII file 2 gt Redirects standard error to a Unicode file 2 gt a Redirects standard error to an ASCII file gt gt Redirects standard output that is appended to a Unicode file gt gt a Redirects standard output that is appended to an ASCII file 1 gt gt Redirects standard output that is appended to a Unicode file 1 gt gt a Redirects standard output that is appended to an ASCII file The EFI Shell will redirect standard output to a single file and standard errors to a single file Redirecting both standard output and standard errors to different files is allowed The following actions are not currently supported e Redirecting standard output and standard errors to the same file e Redirecting standard output to more than one file on the same command e Redirecting standard
48. d Shell mode This release of the EFI Shell supports a maximum of 256 arguments for batch scripts However only a maximum of nine positional variables from 0 to 9 are provided in scripts This version of the Shell adds a new script only command shift which provides access to all the arguments by rotating the positional variables from 0 to 9 4 3 6 Syntax for Variables in Batch Scripts NoTE This rule is true only in enhanced Shell mode The syntax listed in Valid Characters for Variable Names in the Syntax chapter also applies for variables in batch scripts For index variables their names are case sensitive and can only be one of the letters For positional variables their names can only be one of the digits from 0 to 9 4 3 7 Example of Variable Argument and Alias Substitution in Batch Scripts The following uses the script file ArgVar nsh as an example Variable amp Argument substitution echo off for ta in IndexVarA echo Output 1 a b endfor echo on Suppose there is an environment variable 31 defined as EnvVar1 and another variable a defined as EnvVarA fs0 gt ArgVar PosArg1 Argvar gt echo off Output EnvVarlab When the script is executed with an argument 1 is defined as EnvArg1 When the first is met environment variable 1 is attempted which causes the 1 be replaced with EnvArgl1 Then a is 42 4 4 4 5 Batch Scripts met and it is kept as it is Lastly the Sb i
49. ding operation can be unloaded successfully 4 The LOAD is the opposite Examples To find the handle index driver image to unload Shell gt dh b Handle dump 1 Image DXE Foundation 2 FwVol FwFileSys FwVolBlk DevPath MemMap 11 1760000 189FFC8 27 Image Reset 28 Image WinNtBlockIo DriverBinding 29 Image Timer To unload the driver image of Reset Shell gt unload 27 27 Image Reset Unload driver image y n n Exit status code Aborted 128 Commands 5 5 34 ver Summary Displays the version information for this EFI firmware EFI Versions EFI 1 02 and above Usage VER s s Displays only the EFI Shell version Description This command displays the version information for this EFI Firmware or the version information for the EFI Shell itself The information is retrieved through the EFI System Table or the Shell image 1 0to7thRvw July 2005 129 EFI Shell User s Guide Commands Examples Shell gt help ver Displays the version information for this EFI Firmware VER s s Displays the EFI Shell version Examples To display the version information of a platform fs0 gt ver EFI Specification Revision 1 10 EFI Vendor INTEL EFI Revision 14 5 To display the version information of another platform Note that the version information may vary from different platforms due to some platform specific information fs0 gt ver EFI Specification Revision 1
50. ds that are available in the EFI Shell Shell How To s Gives instructions on how to perform various tasks in the EFI Shell Help System of This Document This document is also available in an online help format from the EFI web site To view the help system go to the following URL and go to Tool Documentation gt EFI Shell gt Standalone Product in the table of contents TOC http developer intel com technology efi help efidocs htm Terms The terms listed below are used throughout this document See the master Glossary topic in the EFI Documentation help system and the glossary in the EFI 1 10 Specification for additional definitions of terms and abbreviations that are used in this document or that might be useful in understanding the descriptions presented in this document EFI Shell User s Guide Introduction DXE Driver Execution Environment Phase of operation in the Intel Platform Innovation Framework for EFI that supports running modular code in the form of EFI drivers Common to all platforms Typically in C language See the Intel Platform Innovation Framework for EFI Architecture Specification for more information on this phase EFI The specification containing interface definitions for firmware These interfaces include those that are used by the operating system for booting as well as those for the internal construction of firmware Framework Intel Platform Innovation Framework for EFI An implement
51. e 104 Commands Examples To reset the mapping table to the default mappings shell gt map r Device mapping table 4 UnknownDevice Alias fs0 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 fs0 UnknownDevice Alias f4 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 blk0 UnknownDevice Alias f4 fs0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 1 0to7thRvw July 2005 105 EFI Shell User s Guide Commands To display all mappings in the device mapping table Shell gt map Device mapping table 4 UnknownDevice Alias fs0 b1k0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 fs0 UnknownDevice Alias f4 blk0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A006 11D4 BCFA 0080C73C8881 b1kO UnknownDevice Alias 4 fs0 Device Path VenHw 58C518B1 76F3 11D4 BCEA 0080C73C8881 VenHw 0C95A92F A00 6 11D4 BCFA 0080C73C8881 To display mapping table verbosely Shell gt map v Device mapping table 4 Consist Name Other Name Handle Media Type Removeable Current Dir Device Path 0080C73C8881 0080C73C8881 fs0O Consist Name Other Name Handle Media Type Removeable Current Dir Device Path 0080C73C8881 0
52. e The handle of a device that DriverHandle is managing ChildHandle The handle of a device that is a child of DeviceHandle Notes 1 Default Type 0 Safe Defaults It places a controller in a safe configuration that has the greatest probability of functioning correctly ina platform 1 Manufacturing Defaults Optional type that places the controller in a configuration suitable for a manufacturing and test environment 2 Custom Defaults Optional type that places the controller ina custom configuration 3 Performance Defaults Optional type that places the controller in a configuration that maximizes the controller s performance ina platform Other values depend on the driver s implementation Examples 86 Commands To display the list of devices that are available for configuration Shell gt drvcfg To display the list of devices and child devices that are available for configuration Shell gt drvcfg c To force defaults on all devices Shell gt drvcfg f 0 To force defaults on all devices that are managed by driver 0x17 Shell gt drvcfg f 0 17 To force defaults on device 0x28 that is managed by driver 0x17 Shell gt drvcfg f 0 17 28 To force defaults on all child devices of device 0x28 that is managed by driver 0x17 Shell gt drvcfg f 0 17 28 c To force defaults on child device 0x30 of device 0x28 that is managed by driver 0x17 Shell gt drvcfg f 0 17 28 30 To va
53. e diagnostics in extended mode diagnostics in manufacturing mode handle of the driver to diagnose handle of a device that DriverHandle is handle of a device that is a child of This command invokes the Driver Diagnostics Protocol 1 0to7thRvw July 2005 89 Examples EFI Shell User s Guide Shell gt help drvdiag Invokes the Driver Diagnostics Protocol DRVDIAG c 1 XXX s e m ChildHandle Commands devices ISO 639 2 language standard mode extended mode manufacturing mode DriverHandle DeviceHandle handle of the driver to diagnose handle of a device that DriverHandle is handle of a device that is a child of that are available for Diagnose all child l Diagnose using the specified by XXX s Run diagnostics in e Run diagnostics in m Run diagnostics in DriverHandle The DeviceHandle The managing ChildHandle The DeviceHandle Examples To display the list of devices diagnostics Shell gt drvdiag To display the list available of devices for diagnostics Shell gt To run Shell gt To run English Shell gt To run Spanish Shell gt To run devices Shell gt To run Shell gt To run 90 drvdiag c diagnostics in standard drvdiag s diagnostics in standard drvdiag s 1 eng diagnostics in standard drvdiag s 1l spa diagnostics in standard drvdiag s c diagnostics in extended drvdiag e diagnostics
54. e 31 4 A NOJO irii a tauren ae echnical eae 31 4 2 Batch Script Command Descriptions xiaissactventcreots Rien ties aye eee 31 4 2 1 Summary of Batch Script Commands ceccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeneeeeees 31 4 2 2 Te SOOT AE E altee Gite cc nee hes cosh eater E A teaches eiagte 32 4 2 3 a OLO EEEE hse A il ek ETT vee ed Mean ct cts iene desk Mee ne fara Ata ads 34 4 2 4 MS Cs III Wintec shed hata cia cea ste thc a Ned ald stale elds aie Seg ES T 35 4 2 5 PIUSE iieii inea paa dees Seen vad pepe dene neta eda deer ater AA edad eee 36 426 ATV ci Fee ates nc RAN aea e a a eS Nac 39 4 3 Variable Argument and Alias Substitution cccccccceceeeeeeeseeenteaeeeeeeeessessnsneeeeeeeess 40 4 3 1 Variable Argument and Alias Substitution in Batch Scripts 00 40 4 3 2 Alias Substitution Rule in Batch Scripts cceceeeeeeeeeeeeeeeeeenneeeeeeeeneeeeeee 41 4 3 3 General Variable Substitution Rule in Batch Scripts eessseeeseeeeeeeeeeneeeenne 41 4 3 4 General Command Line Variable Substitution Rule in Batch Scripts 41 4 3 5 Supported Number of Arguments in Batch Scripts sssseeseneeesere ne eeenneeeene 42 4 3 6 Syntax for Variables in Batch Scripts 0 ccecceeeceeeeeeeeeeeeeeeeeeeeeeeeeeneeeeees 42 4 3 7 Example of Variable Argument and Alias Substitution in Batch Scripts 42 4 A COMMENTS arriga ree ae SASE E EEOAE e AE ARESA EE Ea EE ENRE E aE ARRES 43 4 5 Error
55. e Alias Vent 58C518B1 76F3 11D4 BCEA 9880C73CB88 1 VenHwu OCISAIZF AG06 11D4 B 713C8881 UnknownDev ice Alias VenHu 58C518B1 76F3 11D4 BCEA B880C73CBBB 1 VenHw 0C95A935 A006 1104 E FA O080C 7308881 UnknownDevice Alias Venu 58C518B1 76F3 11D4 BCEA 8880C73CB888 1 VenHu 8C9ISAIZF AGO6 1104 5 FA 0080C7308681 seconds to skip any other key to continue Figure 2 1 EFI Shell Look and Feel 2 3 Supported Features 2 3 1 Supported Features The EFI Shell supports the following features which are discussed in more detail in subsequent topics e e 14 Features e Consistent Mapping of File Systems e Output Redirection e Output Streaming Control e Scroll Back Buffer e Verbose Help e Aliases e EFI Compatibility of the EFI Shell e Running Modes and Backward Compatibility 2 3 2 EFI Shell Commands Three types of commands are available in the EFI Shell e Internal commands e External commands e Script only commands The following table describes these commands Table 2 1 Types of Commands Available in the EFI Shell Type of For more information Command Description see Internal Commands that are integrated into the EFI Shell core image Commands chapter These commands provide general purpose management such as file directory management and date time management under the EFI Shell The Shell also provides some EF I specific management commands such as for connecting and d
56. e help will be displayed instead 3 HELP will only show commands that were documented in the Shell Examples To display the list of commands in the EFI Shell and break after one screen Shell gt help b Displays commands list or verbose help of a command alias Displays creates or deletes aliases in the EFI shell attrib Displays or changes the attributes of files or directories cd Displays or changes the current directory cls Clears the standard output with an optional background color connect Binds an EFI driver to a device and starts the driver copy Copies one or more files directories to another location To display help information of a Shell command ls Shell gt help Ils Shell gt ls Shell gt ls 96 Commands To display the list of commands that start with character p Shell gt help p pause Prints a message and suspends for keyboard input 5 5 21 load Summary Loads an EFI driver into memory EFI Versions EFI 1 10 and above Usage LOAD nc file file nc Load the driver but do not connect the driver file File that contains the image of the EFI driver wildcards are permitted Description This command loads an EFI driver into memory It can load multiple files at one time and the file name supports the asterisk wildcard If the nc flag is not specified this command will try to connect the driver to a proper device meanwhile it may cause load
57. e information on running modes Table 4 2 Additional Information on Running Modes Topic Chapter Description Running Modes and Features Provides general information on running modes in the Shell Backward Compatibility Nesting Batch Scripts Batch Scripts Discusses running modes in nested batch scripts 4 7 Nesting Batch Scripts Execution of batch script files can be nested that is script files may be executed from within other script files Recursion is allowed A batch script can contain one or more batch scripts The maximum nesting level is 9 The embedded batch script will be executed as a command After the whole embedded batch script is executed completely the next command will be executed The EFI Shell will automatically save and restore the running mode before and after the execution of nested scripts so that the changes of running modes in nested scripts will not affect the running mode of a parent script 4 8 Output Redirection in Batch Scripts Output redirection is fully supported in scripts 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 4 9 Batch Scripts script causes the output for all commands that are executed from that batch script to be redirected to the file with the output of each command appended to the end of the file If a command in a script redirects its output to file1 but the output is red
58. e or more files or directories RM q file directory file directory q Quite mode does not prompt user for a confirmation file File name wildcards are permitted directory Directory name wildcards are permitted Note 1 Removing a read only file directory will result in a failure Removing a directory containing read only file s will result ina failure 2 If an error occurs RM will exit immediately and later files directories will not be removed 3 You cannot remove a directory when the current directory is itself or its subdirectory 4 If file contains wildcards it will not ask user for confirmation 5 You cannot remove the root directory 6 You cannot remove the current directory or its ancestor 7 Redirecting output to a file that exists under the directory that will be removed is not allowed Examples To remove multiple directories at a time fs0 gt 1s test Directory of fs0 test 06 18 01 01 01p lt DIR gt 512 06 18 01 01 01p lt DIR gt O uy 06 19 01 12 59a lt DIR gt 512 temp1 06 19 01 12 59a lt DIR gt 512 temp2 0 File s 0 bytes 4 Dir s Error occurs and RM will exit fs0 gt rm test temp11 temp2 rm del Cannot find fs0 test temp11 Not Found To remove multiple directories with wildcards fs0 gt rm test temp 1 0to7thRvw July 2005 117 EFI Shell User s Guide Commands rm del Remove subtree fs0 test templ y n y removing fs0 test temp1 temp1
59. e recursively copied to the destination Src itself will be copied 2 If dst parameter is not specified then the current directory is assumed to be the destination 3 Cp r srcl src2 dst is to copy all files and subdirectories in srcl and srce2 to the dst Srcl and src2 themselves are also copied dst parameter will be interpreted as a directory 4 Copying a directory file to itself is not allowed 5 If an error occurs cp will exit immediately and the remaining files or directories will not be copied 6 When cp is executed with a script file it always performs quiet copy regardless of whether the q option is specified 7 If are copying multiple files the destination must be an existing directory Examples To display the contents of current directory first of all fs0 gt 1s Directory of fs0 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 testl 06 18 01 01 02p lt DIR gt 512 test2 06 13 01 10 00a 28 739 IsaBus efi 06 13 01 10 00a 32 838 IsaSerial efi 1 0to7thRvw July 2005 67 EFI Shell User s Guide Commands 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 3 File s 61 606 bytes 4 Dir s To copy a file in the same directory but change the file name fs0 gt cp temp txt readme txt copying fs0 temp txt gt fs0 readme txt ok To copy multiple files to another directory fs0 gt cp temp txt isaBus efi test copying fs0 temp t
60. e with the terms of the license The information in this manual is furnished for informational use only is subject to change without notice and should not be construed as a commitment by Intel Corporation to update or revise the information or document Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document This document provides website addresses for certain third party websites The referenced sites are not under the control of Intel and Intel is not responsible for the content of any referenced site or any link contained in a referenced site Intel does not endorse companies or products for sites which it references If you decide to access any of the third party sites referenced in this document you do this entirely at your own risk Other names and brands may be claimed as the property of others Intel the Intel logo Itanium and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries Copyright 2000 2005 Intel Corporation All Rights Reserved il Revision History 1 0_toRvw Finished editing pass and first help version Sent to engr owner for 7 15 04 review This version is missing the Shell How To s chapter will be added soon ee a aan l Added Shell How To s chapter and sent for review 8 2 04 1 0_to2ndRvw Incorpora
61. ed drivers be connected to their corresponding devices This action is not a bug but the implementation policy 1 0to7thRvw July 2005 97 EFI Shell User s Guide Commands Examples 5 5 22 Shell gt help load Loads EFI drivers and then they can provide available services LOAD nc file file nc Load the driver but do not connect the driver file File that contains the image of the EFI driver wildcards are permitted Note 1 LOAD can deal with multiple files and supports wildcards 2 Use UNLOAD command to unload a driver if it supports unloading 3 If option nc is not specified then the loaded drivers will be automatically connected If nc is specified then none of the loaded drivers will be connected Loading without nc could cause the previously loaded drivers to be connected This is not a bug and it complies with EFI specification Examples fs0 gt load Isabus efi load Image fs0 Isabus efi loaded at 18FE000 Success fs0 gt load Isabus efi IsaSerial efi load Image fs0 Isabus efi loaded at 18E5000 Success load Image fs0 IsaSerial efi loaded at 18DC000 Success fs0 gt load Isa efi load Image fs0 IsaBus efi loaded at 18D4000 Success load Image fs0 IsaSerial efi loaded at 18CB000 Success s0 gt load nc IsaBus efi load Image fs0 Isabus efi loaded at 18FE000 Success Shell gt Is Summary Lists a directory s contents or file informatio
62. ed to each other very easily See the Shell How To s chapter for instructions on switching internal commands to external commands and vice versa However some internal commands are internal only and cannot be switched to external commands because they are too close to the EFI Shell core and it is not reasonable to make them external These commands are noted with a double asterisk in Shell Internal Command Descriptions Overview and in the detailed description of each command External commands have to reside in a file system As a result to run them users need to have at least one mapped file system and put those external commands under this file system Supported EFI Protocols in the Shell The table below shows all the supported protocol information in the EFI Shell Some Shell commands need this information to operate For example the dh command needs the protocol symbol for its p flag to list all the handles on which the specific protocol was installed Table 5 1 EFI Shell Protocol Information Table Protocol Symbol EFI Protocol Blklo Block I O Protocol 46 BusSpecificDriverOverride ComponentName Configuration Conlin ConOut DebugPort DebugSupport Decompress Devlo Diagnostics Disklo Dpath DriverBinding ErrOutSplit Fs Image IsaAcpi Isalo LegacyBoot Load Net Nii Pcilo PciRootBridgelo Pxebc Scsilo ScsiPassThru Seriallo SimplePointer StdErr Tcp Txtin TxtInSplit Txtout TxtOutSplit Ug
63. es are listed below 1 Except for numeric characters and all other characters in the argument are invalid The Shell will report an error if the number is in the wrong month date year range 2 Space before or after the numeric character is not allowed Inserting a space into the number is invalid 3 Repeated zeros are allowed before the number For example Shell gt date 0000008 000004 000097 Shell gt date 08 04 2097 Shell gt 4 The year range is greater than or equal to 1998 Two numeric characters indicate the year Numbers below 98 are regarded as 20xx and numbers equal to or above 98 are regarded as 19xx 00 means 2000 For example Shell gt date 8 4 97 Shell gt date 08 04 2097 Shell gt Shell gt date 8 4 98 Shell gt date 08 04 1998 Shell gt 5 The range of valid years is from 1998 2099 1 0to7thRvw July 2005 69 EFI Shell User s Guide Commands Examples Shell gt help date Displays the current date or sets the date in the system DATE mm dd yylyy mm Month of date to be set Month range 1 12 dd Day of date to be set Day range 1 31 yyyy Year of date to be set Year range 1998 2099 Note 1 yy 98 1998 99 1999 00 2000 01 2001 97 2097 2 yyyy 1998 2099 other values are invalid 3 EFI may behave unpredictably if illegal date values are used Examples To display the current date in the system fs0 gt date 06 18 2001 To set the date with long yea
64. ether a specified condition is true or false Usage The i command has two forms 1 if not exist filename then command arguments command arguments else command arguments command arguments endif 2 if i not stringi string2 then command arguments command arguments else command arguments command arguments fe endif Description The if command executes one or more commands before the else or endif commands if the specified condition is true otherwise commands between else if there is an else and endif are executed 1 0to7thRvw July 2005 35 EFI Shell User s Guide Batch Scripts In the first usage above of if the exist condition is true when the file that is specified by filename exists The filename argument may include device and path information This first form of if also supports wildcard expansion If more than one file matches the wildcard pattern the condition evaluates to TRUE In the second usage the stringi string2 condition is true if the two strings are identical Here the comparison can be case sensitive or insensitive depending on the optional switch i If i is specified it will compare strings in the case insensitive manner if i is not specified it compares strings in the case sensitive manner The else command is optional in an if else statement Examples Example script for if command if exist fs0 myscript nsh then myscript myargl
65. file to the standard output device If no options are used then the file type is automatically detected and sent to the standard output device If the a option is 124 Commands specified the file is sent to the standard output device as a stream of ASCII characters If the u option is specified the file is sent to the standard output device as a stream of Unicode characters The example below shows how to send the ASCII file README TXT on the floppy drive to the standard output device and the Unicode file READMEU TXT on the floppy drive to the standard output device Type redirection to the same file is not supported currently Wildcards are permitted in the file name If the type command is used in conjunction with an ASCII file with the u flag this flag will be ignored and the contents of the file will be sent to the standard output device as ASCII characters If the type command is used in conjunction with a Unicode file with the a flag the file will be sent as ASCII characters but with an additional space between each character 1 0to7thRvw July 2005 125 EFI Shell User s Guide Commands Examples Shell gt help type Displays the contents of a file on the standard output device TYPE al u file file a Displays the file as ASCII characters u Displays the file as Unicode characters file Name of file to display Examples To display the file as Unicode characters fs0 gt type u pause nsh Fi
66. files directories with h or s attribute fs0 gt dir Directory of s0 06 18 01 09 32p 153 for nsh 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 testi 06 18 01 01 02p lt DIR gt 512 test2 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 01 28 01 08 24p r 29 readme txt 3 File s 211 bytes 4 Dir s To display files with all attributes in the current directory fs0 gt dir a Directory of fs0 06 18 01 09 32p 153 for nsh 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 test1 06 18 01 01 02p lt DIR gt 512 test2 06 18 01 10 59p 28 739 IsaBus efi 06 18 01 10 59p 32 838 IsaSerial efi 78 Commands 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 01 28 01 08 24p t 29 readme txt 5 File s 61 788 bytes 4 Dir s To display files with read only attributes in the current directory fs0 gt dir ar Directory of fs0 06 18 01 11 14p xr 29 readme txt 1 File s 29 bytes 0 Dir s To display the files with attribute of s fs0 gt dir as isabus efi Directory of fs0 06 18 01 10 59p 28 739 IsaBus efi 1 File s 28 739 bytes 0 Dir s To display all in fs0 efi directory recursively fs0 gt dir r a efi To search for files with the specified type in the current directory recursively fs0 gt dir r a efi b Shell gt 5 5 14 disconnect NoTE This command is an internal only command It cannot be
67. for tindexvar run start end step command arguments command arguments endfor Description The for command executes one or more commands for each item in a set of items The set may be text strings file names or a mixture of both separated by spaces if not in quotation marks If the length of an element in the set is between 0 and 256 and if the string contains wildcards the string will be treated as a file name containing wildcards and be expanded before command is executed If no such files are found after expansion the literal string itself is kept Indexvar is any alphabet character from a to z or A to Z and they are case sensitive It should not be a digit 0 9 because digit will be interpreted as a positional argument in the command line that launches the script The name space for index variables is separate from that for environment variables so if indexvar has the same name as an existing environment variable the environment variable will remain unchanged by the for loop Each command is executed once for each item in the set with any occurrence of 3indexvar inthe command being replaced with the current item In the second format of the for endfor statement indexvar will be assigned a value from start to end with an interval of step The start and end values can be any integer whose 32 Batch Scripts length is less than 7 digits excluding the sign and it can also apply to st ep with one exception of zero
68. guments on the command line you need to use quotation marks to help pass arguments that contain blank spaces to commands For example if you want to list a directory named good news type the following at the command prompt dir good news If you type the following at the command prompt instead the EFI Shell will think that you want to list two directories good and news dir good news Specifying the Boundaries for Variable Substitution In this version of the EFI Shell users can specify the boundary inside which variable substitution will be performed In a single argument quotation marks can define the boundaries that divide the argument into multiple parts variable substitution will then be performed in each part For example say we have an environment variable 1a whose content is xyz and a script a nsh as follows 1 0to7thRvw July 2005 137 6 9 EFI Shell User s Guide Shell How To s for a in 1 2 3 echo la a endfor If we execute the command a nsh abc the string abc will be taken as the first positional argument 1 to this script the output will be the following xyza xyza xyza The substitution of environment variables has higher priority than that of positional arguments So if we want the result to be the following abcal abca2 abca3 The script should be written like the following for ta in 1 2 3 echo l a a endfor How to Understand the Use of the Escaping Character The c
69. haracter is defined as the escaping character in the EFI Shell It can unconditionally make any character that immediately follows it a literal character and thus prevents that following character from being interpreted as having special meaning However if a character is immediately followed by another character the second character becomes a literal character and cannot escape the immediately following character in other words the character that immediately follows the second character is not made literal and will still be interpreted as having special meaning In the EFI Shell flags or switches on a command line all start with or character so the side effect is that all arguments that start with or will be interpreted as flags by default For example typing echo Title at the command prompt will give you the following error message echo Unknown flag Title The escaping character can be very useful in this case Putting an escaping character before the or as shown in the following example will stop the EFI Shell from interpreting the following string as a flag echo Title You can also use a pair of quotation marks to do the same thing However a pair of quotation marks cannot make the escaping character literal and they also cannot make quotation marks literal If you want to pass quotation marks to a command as part of the argument you must use the escaping character to transfer the
70. he arguments in the list have been executed 5 5 3 alias NoTE This command is an internal only command It cannot be switched to an external command Summary Displays creates or deletes aliases in the EFI Shell environment EFI Versions EFI 1 02 and above Usage ALIAS d v sname value d Deletes an alias v Volatile variable sname Alias name value Original name Description This command displays creates or deletes aliases in the EFI Shell environment An alias provides a new name for an existing EFI Shell command or an EFI application Once the alias is created it can be used to run the command or launch the EFI application There are some aliases that are predefined in the EFI Shell environment These aliases provide the MS DOS and Unix 1 0to7thRvw July 2005 51 EFI Shell User s Guide Commands equivalent names for the file manipulation commands The examples below show the default aliases that are available in the EFI Shell See the following for more information on alias substitution e Alias Substitution in the Syntax chapter e Alias Substitution Rule in the Batch Scripts chapter Examples Shell gt help alias Displays creates modifies or deletes aliases in the EFI Shell environment ALIAS d v sname value d Deletes an alias v Volatile variable sname Alias name value Original name Note 1 sname should not be an internal Shell comman
71. he EFI Shell cccccsccccceeesssssnsneeeeeeeeesseesesneseeeeeeees 140 6 14 How to Determine the Version of the EFI Shell cccccecseesssseeeeeeeessesseseeeeeeeeeeees 140 6 15 How to Get Help Information gs scss seeecseesecaecanngiien sed bases oh andaeleiu exehiemrevers nideredssegentnnea Mens 141 6 16 How to Terminate the Execution of COMMANAS cccccccceeesesseeeeeeeeeeeeseeeeteeeeeeeeeees 141 6 17 How to Pause the Screen Outputs cecocsnntangnteanienieetdee Xiah tad eteeiendeees 141 6 18 How to View the Screen HiStOry ccccccceesccceeeeeenceeeeeesaaeeeeesaeeeseseeeeeseeseeeeeeeeeaaaeees 142 6 19 How to Redirect the Output of Commands to Files cece eeeeseseeceeeeeeeeesseeeeeeeeeeeees 142 6 20 How to View the Contents of a Text File cc cceccecccceccceeeeeeesennneeeeeeeeeeseeesseneeeeeeeees 142 6 21 How to Edit a Text File ccc ec ceec cece cece cece eeeeeeeeeeeeeeeeeeeseeeeeeeseeeeeeeeeeeseeeseeeeeeeseeeeeeees 142 6 22 How 10 Edita Binary Filesi iets farsi euries saan sede Aca aiaa a AAEE ee Rohe 142 6 23 How to Edit Disk BIOCKS ccccceeecceeceeeeeee tent r E RE E E a E EAT 143 1 0to7thRvw July 2005 vii EFI Shell User s Guide 6 24 HOW t Edit MOMOny isrener aan EEA EKAA Er 143 6 25 How to Connect a Driver to a Device oo eee eeecceeeeeeeeeeeeeeeaeeeteeeaeeeeeeeeaaeeeeeeeaaeeees 143 Figures Figure 2 1 EFI Shell Look and Feel 3 ctcescsnaieticnccdezsdaleseetecasdactace hi
72. he wildcards to delete or show the mapping name However when you assign the mapping name wildcards are forbidden 1 0to7thRvw July 2005 103 EFI Shell User s Guide Commands Examples Shell gt help map Displays or defines mappings between user defined names and device handles MAP d lt sname gt MAP r v c t lt type type gt sname MAP sname handle mapname d Deletes a mapping r Resets to default mappings v Lists verbose information of mappings sname Defines a name for the mapping by users handle The number of handle which is same as dumped from dh command c Shows the consistent mapping name f Shows the normal mapping name not consistent mapping t Shows the device mapping name according the device type type The device type The current supported types are fp Floppy hd Hard Disk cd CD Rom Types can be combined by putting a comma between two types Spaces are not allowed between types mapname The device s mapped name Use this parameter to assign a new mapping name to a device There is a postfix after the mapname Note 1 Consistent mapping is persistent across the map r command and a system reboot 2 Only characters and numbers are allowed inside of sname 3 Redirection is not allowed when running map because we do not know the file system before mapping is done 4 Output redirection is not supported for map r usag
73. hell ternen rae nania ae En aaaea ER a AAE ELERES 16 2 3 5 PATH Variable Support eeaeccdears bina ing oucatd net ae Siesacclede sac tpixareGcnupeeteceaceneionteeume 16 2 3 6 KEY History SUPDOM es eeri eranen eaea Ee Aa e daa a ate aiis 17 2 3 7 Exec tion Interr Upis eien tsino l i e Ron a E eE 17 2 3 8 Consistent Mapping of File Systems snsseessenneeseeeenneeennresssrrrnerrrnnresnrresene 18 2 3 9 Output REGIS CON sereen reee raaa aaia eaa aa AAEE aikaa Ta ae TSERE iena aani 18 2 3 10 Output Streaming Controls 4x ieccseecttand dead Maces eveslnacedhuah Gcacanacch axgeaeenetencanss 18 2 3 11 Scroll Back Buffer Support acsescekez ee aie Si Se acetone eee eaan oka aha weee case 19 2 3 12 Verbose Help Support iacic5cad ies ceceeeees tesa sles tarts es hoe eet eta ae 19 23 13 EFI Compatibility ofthe EFI Snell ics ccckitanhaceaan hand iaiacs taaeuet 19 2 3 14 Running Modes and Backward Compatibility Support eee eeeeeteeeees 20 24 lInwokinig the EPI SMM ariere ER a R 20 2 4 1 Invoking INGE PUSH csnrcca seca cases ead ws cee son saat beached stnenceaeermarmoan devant eennuesan 20 2 4 2 Start up Batch File Startup nsh eecceeeesseeeeeeeeeeeeeeeeeeeeeeeeeeaaeeeeeesaaeeeeeas 20 2 4 3 EF Shell PEOM pl xscc vase cates Suc edecscentened sees caved E AA e Ea TAA A AEAEE EiS 21 S11 b APEE E ETT eR Pree ee eer ee iene Eee eee 22 3l THMHOCUICTIOM siim a eaa a aaa mend am acho eases ete reed alee aude 22 3 2 VOD OCIA Characters asset ce
74. hes that can be used in specific Shell commands The text after the command name are arguments or switches 1 0to7thRvw July 2005 27 3 6 EFI Shell User s Guide Syntax Shell gt load nc IsaBus efi Shell gt map r Shell gt connect c Shell gt set d diagnosticpath All of the internal and external Shell commands support the flag b This flag tells the command to display one screen at a time This flag is very useful when listing the help information of a command Because it is a default flag that is available in all commands it is not listed in the commands syntax or help information Quotation Marks The EFI Shell uses quotation marks for argument grouping A quoted string is treated as a single argument to a command or as a part of a single argument to a command Any white space including spaces tabs and commas that is included in the quoted string is simply part of that single argument Double quotation marks are used to denote strings and should appear in pairs However if unpaired quotation marks appear in a command line they will be discarded before passing to the command entry point Empty strings are treated as valid command line arguments It is up to each command whether to ignore these empty strings Quotation marks can define the smallest unit upon which variable substitution will be performed This smallest unit is called a part A part is a subset of a single argument For example there are three p
75. hild devices that this driver has produced eDRIVER NAME The name of the driver from the Component Name Protocol e IMAGE NAME The file path from which the driver was loaded 82 Examples Shell gt help drivers Commands Displays the list of drivers that follow the EFI Driver Model DRIVERS 1 XXX 1 language Display Format Displays drivers using the ISO 639 2 specified by XXX DRV The handle number of the EFI driver TYPE The driver type B Bus driver D Device driver CFG The driver supports the Driver Configuration Protocol DIAG The driver supports the Driver Diagnostics Protocol D The number of devices that this driver is managing C The number of child devices that this driver has produced DRIVER NAME The name of the driver from the Component Name Protocol IMAGE NAME The file path from which the driver was loaded Examples To display the 1 Shell gt drivers ist T D D Cr R PFA V VERSION E G G D C DRIVER NAME IMAGE NAME 39 00000010 D 1 Platform Console Management Driver ConPlatform 3A 00000010 D 1 Platform Console Management Driver ConPlatform 3B 00000010 B 1 1 Console Splitter Driver ConSplitter 3c 00000010 Console Splitter Driver ConSplitter 3D 00000010 B 1 1 Console Splitter Driver ConSplitter 3E 00000010 Console Splitter Driver ConSplitter 42 00000010 D 1 UGA Console Driver GraphicsConsole 1 0to7thRvw July 2005 83
76. hild handles of the DeviceHandle 3 If no DriverHandle parameter is specified the default is to disconnect all driver handles on the DeviceHandle 4 This command does not support output redirection Examples To disconnect all drivers from all devices Shell gt disconnect r To disconnect all drivers from device 0x28 fs0 gt disconnect 28 To disconnect driver 0x17 from device 0x28 fs0 gt disconnect 28 17 To disconnect driver 0x17 from controlling the child 0x32 of device 0x28 fs0 gt disconnect 28 17 32 Shell gt 1 0to7thRvw July 2005 81 EFI Shell User s Guide Commands 5 5 15 drivers Summary Displays a list of information for drivers that follow the EFI Driver Model in the EFI environment EFI Versions EFI 1 10 and above Usage DRIVERS 1 XXX 1 Displays drivers using the ISO 639 2 language specified by XXX Description This command displays a list of information for drivers that follow the EFI Driver Model in EFI environment The list has the following columns eDRV The handle number of the EFI driver e VERSION The version number of the EFI driver eTYPE The driver type A B in this column indicates a bus driver and D indicates a device driver eCFG Indicates that the driver supports the Driver Configuration Protocol eDIAG Indicates that the driver supports the Driver Diagnostics Protocol e D The number of devices that this driver is managing e C The number of c
77. hild of DeviceHandle Description This command invokes the Driver Configuration Protocol The table below describes the values for the Type parameter Other values depend on the driver s implementation Table 5 5 Default Values for the Type Parameter Value Type of Default Description 0x0000 Safe Defaults Places a controller in a safe configuration that has the greatest probability of functioning correctly in a platform 0x0001 Manufacturing Defaults Optional type that places the controller in a configuration that is suitable for a manufacturing and test environment 0x0002 Custom Defaults Optional type that places the controller in a custom configuration 0x0003 Performance Defaults Optional type that places the controller in a configuration that maximizes the controller s performance in a platform 1 0to7thRvw July 2005 85 EFI Shell User s Guide Commands Examples Shell gt help drvcfg Invokes the Driver Configuration Protocol DRVCFG 1 XXX c f lt Type gt v s DriverHandle DeviceHandle ChildHandle lt Configure all child devices L Configure using the ISO 639 2 language specified by XXX f Force defaults v Validate options s Set options Type The type of default configuration options to force on the controller 0 Safe Defaults 1 Manufacturing Defaults 2 Custom Defaults 3 Performance Defaults DriverHandle The handle of the driver to configure DeviceHandl
78. his command updates the time and date on the file that is specified by the file parameter to the current time and date Examples Shell gt help touch Updates time and date with current time TOUCH r file file r Recursive to subdirectories file The name or pattern of file or directory There can be multiple files on the command line Notes 1 If multiple files are specified on the command line it will continue processing even fail to touch some of them 2 Touch can not change the time and date of read only files and directories 1 0to7thRvw July 2005 123 EFI Shell User s Guide Commands Examples To touch a file the time and date of file will be changed after TOUCH fs0 gt 1s for nsh Directory of fs0 06 18 01 09 32p 153 for nsh 1 File s 153 bytes 0 Dir s fs0 gt touch for nsh touch fs0 for nsh ok fs0 gt 1s for nsh Directory of s0 06 19 01 09 54a 153 for nsh 1 File s 153 bytes 0 Dir s To touch a directory recursively fs0 gt touch r efil 1 touch fs0 efil 1 ok touch fs0 efil 1 boot ok touch fs0 efil 1 boot nshell efi ok 5 5 32 type Summary Sends the contents of a file to the standard output device EFI Versions EFI 1 02 and above Usage TYPE a u file file a Displays the file as ASCII characters u Displays the file as Unicode characters file Name of file to display Description This command sends the contents of a
79. in a Bold Monospace typeface that is underlined and in blue indicate an active hyperlink to the code definition for that function or type definition Click on the word to follow the hyperlink Note that these links are not active in the PDF of the specification Also these inactive links in the PDF may instead have aBold Monospace appearance that is underlined but in dark red Again these links are not active in the PDF of the specification In code or in text words in Italic Monospace indicate placeholder names for variable information that must be supplied i e arguments In code words ina Plain Monospace typeface that is a dark red color but is not bold or italicized indicate pseudo code or example code These code segments typically occur in one or more separate paragraphs July 2005 11 EFI Shell User s Guide Introduction text text text In the PDF of this specification text that is highlighted in yellow indicates that a change was made to that text since the previous revision of the PDF The highlighting indicates only that a change was made since the previous version it does not specify what changed If text was deleted and thus cannot be highlighted a note in red and highlighted in yellow that looks like Note text text text appears where the deletion occurred See the glossary sections in the EFT 1 10 Specification and in the EFI Documentation help system for definitions of terms and abbreviations that are used in thi
80. internal only command It cannot be switched to an external command Summary Displays the device handles in the EFI environment EFI Versions EFI 1 10 and above 1 0to7thRvw July 2005 73 EFI Shell User s Guide Commands Usage DH 1 lt lang gt handle p lt prot_id gt d v handle Dumps information of a specified handle always taken as hexadecimal number p Dumps all handles of a protocol specified by prot_id d Dumps EFI Driver Model related information 1 Dumps information using the ISO 639 2 language specified by lang v Dumps verbose information on specified handle Description This command displays the device handles in the EFI environment If this command is used with a specific handle number the details of all the protocols that are associated with that device handle are displayed Otherwise the p option can be used to list the device handles that contain a specific protocol See Supported EFI Protocols in the Shell for the abbreviations that are used with this command for EFI protocols The following examples show how the command can be used 74 Commands Examples Shell gt help dh Displays the handles in the EFI environment DH 1 lt lang gt handle p lt prot_id gt d v handle Dumps information of a specified handle always taken as hexadecimal number p Dumps all handles of a protocol specified by prot_id d Dumps EFI Driver Model related information 1
81. ion Marks e Output Redirection e File Naming Conventions 3 2 Special Characters The EFI Shell implements a programming language that provides control over the execution of individual commands Command names and keywords in certain commands are all case insensitive When the Shell scans its input it always treats certain characters gt space and newline specially Care should be exercised when using these characters The following table describes the uses of these characters Table 3 1 Special Characters in the EFI Shell Character Description Newline Ends a command line space Ends an argument if it is not in quotation marks This character is sometimes referred to as the splitting character Starts a comment gt Used for output redirection Used to delimit a variable or an argument i Used to delimit a quotation i Prevents the next character from being interpreted as having special meaning This character is referred to as the escaping character Z El Wildcards to specify multiple similar file names 22 Syntax 3 3 Variable and Alias Substitution 3 3 1 Environment Variables and Variable Substitution Environment variables are variables that can hold user specified contents and can be read on a command line or in scripts There are two kinds of environment variables e Volatile environment variables e Nonvolatile environment variables Volatile environment variab
82. irected to file2 on invocation of a whole script the output of that command will be redirected to file1 However the echo of the command itself if the echo state is on will appear in ile2 as well as the output of all other commands Echoing in Batch Scripts By default both the input and output for all commands that are executed from a batch script are echoed to the console Use the echo off command to suppress displaying commands that are read from a batch file In addition you can insert an additional character before a command in a batch file to prevent the current command from being echoed When a script is launched from the interactive Shell by default its echo state inherits the echo state of the interactive Shell Changing the echo state in the script does not affect the echo state of the interactive Shell When a script calls another script the called script inherits the caller script s current echo state However if the called script changes the echo state after returning the caller s echo script also changes 4 10 Known Limitations with the Shell Scripting Language The following are some known limitations with the EFI Shell scripting language capabilities e Do not try to read from and write to the same file within a single command For example do not use the following fs0 gt type test nsh gt test nsh e Do not use the goto command to jump into another loop e Do not use the same index variable in nested for
83. is command can be used to create a new environment variable or to modify an existing environment variable If the set command is used without any parameters then all the environment variables are displayed If the set command is used with the d option then the environment variable that is specified by sname will be deleted The following examples show how this command can be used to create modify and delete the environment variable DiagnosticPath 1 0to7thRvw July 2005 119 EFI Shell User s Guide Commands Examples Shell gt help set Displays creates changes or deletes EFI environment variables SET v sname value SET d lt sname gt d Deletes the environment variable v Volatile variable sname Environment variable name value Environment variable value Notes 1 Size of NVRAM for set command will depend on the system implementation 2 May send NVRAM variables to efi boot bootstr nvr on the file system if no NVRAM is implemented in the core EFI routines 3 SET values are stored in EFI NVRAM and will be retained between boots unless the option v is specified 4 A in front of sname means that this variable is a volatile variable To make any changes to it please use the command with the voption Examples To add an environment variable Shell gt set DiagnosticPath fs0 efi diag fs1 efi diag To display environment variables Shell gt set path ae diagnosticPath fs0 efil 1
84. is presented in a C like format using C conventions where appropriate The coding style particularly the indentation style is used for readability and does not necessarily comply with an implementation of the Extensible Firmware Interface Specification 1 4 3 Typographic Conventions This document uses the typographic and illustrative conventions described below Plain text Plain text blue Bold Italic BOLD Monospace Bold Monospace Italic Monospace Plain Monospace 1 0to7thRvw The normal text typeface is used for the vast majority of the descriptive text in a specification In the online help version of this specification any plain text that is underlined and in blue indicates an active link to the cross reference Click on the word to follow the hyperlink Note that these links are not active in the PDF of the specification In text a Bold typeface identifies a processor register name In other instances a Bold typeface can be used as a running head within a paragraph In text an Italic typeface can be used as emphasis to introduce a new term or to indicate a manual or specification name Computer code example code segments and all prototype code segments use a BOLD Monospace typeface with a dark red color These code listings normally appear in one or more separate paragraphs though words or segments can also be embedded in a normal text paragraph In the online help version of this specification words
85. is variable using the following command where xxx is the valid value for efishellmode set v efishellmode xxx Users can read the value of efishellmode the same as when they are reading a normal environment variable se ishellmode For more information on this variable see Running Modes and Backward Compatibility in the Features chapter StartupDelay Set the Startup nsh delay time 3 3 6 Variable Substitution Flowchart The following figure shows the sequence for variable and argument substitution x means an index variable and n means a positional variable 1 0to7thRvw July 2005 25 EFI Shell User s Guide Syntax is found Is it Yes var Does tvart exist Yes Substitute with No environment variable No Is it in a script Yes Yes Does Yes Substitute with No index x exist variable Yes No No Does Yes n exist Substitute with Substitute with a Isit Yes empty string positional Svar argumen No Substitute Discard the var with an empty string Figure 3 1 Variable and Argument Substitution Flowchart 26 Syntax 3 4 Wildcard Expansion The and characters can be used as wildcard characters in file name arguments to certain Shell commands Besides the file or directory operation commands the script only for and if commands also expand arguments containing wildcard characters to existing file names that match the pattern A before
86. isconnecting devices and loading and unloading EFI drivers External A set of Shell applications External Commands in the Commands chapter Script only Commands that can be executed only when using batch script Batch Scripts chapter files All commands are invoked by typing the name of the command at the Shell command prompt also called just the Shell prompt 2 3 3 Batch Scripts The EFI Shell can execute commands from a file which is called a batch script file or batch script program These files allow users to simplify routine or repetitive tasks A batch script program is a Unicode or ASCII text file that contains one or more commands and has an nsh file name extension EFI Shell batch script files are invoked by typing the file name at the command prompt with or without the file name extension Commands in the file are then executed sequentially 1 0to7thRvw July 2005 15 EFI Shell User s Guide Features All Shell commands can be executed in batch scripts In addition this version of the Shell provides a set of script only commands to do the following e Perform basic flow control e Allow branching and looping in a script e Allow users to control input and output and call other batch programs known as script nesting Script only means that those commands can be executed only in Shell batch script files and cannot be executed at the Shell prompt See the Batch Script chapter for detailed descriptions of ba
87. isplay the files with attribute of s fs0 gt ls as isabus efi Directory of fs0 06 18 01 10 59p 28 739 IsaBus efi 1 File s 28 739 bytes O Dir s To display all in fs0 efi directory recursively fs0 gt 1s r a efi To search for files with the specified type in the current directory recursively fs0 gt ls r a efi b Shell gt 5 5 23 map NoTE This command is an internal only command It cannot be switched to an external command Summary Defines a mapping between a user defined name and a device handle EFI Versions EFI 1 02 and above 1 0to7thRvw July 2005 101 EFI Shell User s Guide Commands Usage MAP d lt sname gt MAP r v c t lt type type gt sname MAP sname handle mapname d Deletes a mapping r Resets to default mappings v Lists verbose information of mappings sname Defines a name for the mapping by users handle The number of handle which is same as dumped from dh a command c Shows the consistent mapping name f Shows the normal mapping name not consistent mapping t Shows the device mapping name according the device type type The device type The current supported types are fp Floppy hd Hard Disk cd CD Rom Types can be combined by putting a comma between two types Spaces are not allowed between types mapname The device s mapped name Use this parameter to assign a new mapping name to a de
88. l gt 5 5 8 copy Summary Copies one or more source files or directories to a destination EFI Versions EFI 1 02 and above 62 Commands Usage COPY r q sre srce dst f Recursive copy q Quiet copying replace existing files without prompt src Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Description This command copies one or more source files or directories to a destination If the source is a directory the r flag must be specified If r is specified then the source directory will be recursively copied to the destination which means that all subdirectories will be copied If a destination is not specified then the current working directory is assumed to be the destination If any target file not directory already exists there will be a prompt asking the user to confirm replacing the file The following four choices are available e Yes Replace the file eNo Do not replace the file e All Replace the existing files in all subsequent cases eCancel Do not replace any existing files in all subsequent cases If there are multiple source files directories the destination must be a directory 1 0to7thRvw July 2005 63 EFI Shell User s Guide Commands Examples Shell gt help copy Copies one or more files directories to another location COPY r q sre srce dst r Recursive copy q Quiet
89. le fs0 pause nsh Size 204 i Example script for pause command echo pause nsh begin date time pause echo pause nsh done To display the file as ASCII characters fs0 gt type a pause nsh File fs0 pause nsh Size 204 Example script for pause command echo pause nsh begin date time pause echo pause nsh done To type multiple files at a time fs0 gt type test File fs0 test txt Size 23 How to Install File fs0 test nsh Size 48 time stall 3000000 time Shell gt 126 Commands 5 5 33 unload Summary Unloads a driver image that was already loaded EFI Versions EFI 1 10 and above Usage UNLOAD n v Handle n Without prompt v Dump Verbose information Handle Handle of driver to unload always taken as hexadecimal number Description This command unloads a driver image that was already loaded 1 0to7thRvw July 2005 127 EFI Shell User s Guide Commands Examples Shell gt help unload Unloads a driver image UNLOAD n v Handle n Without prompt v Dump Verbose information Handle Handle of driver to unload always taken as hexadecimal number Note 1 Option n can be used to skip all the prompts during the unloading so that it can be used in a batch file 2 If option v is specified the verbose information on the image will be displayed before the image is unloaded 3 Only those images that can support the unloa
90. les will be lost when the system is reset or turned off Nonvolatile environment variables will not change until they are modified or deleted Environment variables can be set and viewed using the set command To access the value of an environment variable delimit the name of the variable with a character before and after the variable name for example tmyvariable The variable names are case insensitive Variable substitution is not a recursive process If a is set to sb and b is set to 123 the substitution result of a is b not 123 In addition to the other topics in this subsection see Variable Argument and Alias Substitution in the Batch Scripts chapter for more information 3 3 2 Alias Substitution If the first argument of a command is a defined alias the Shell replaces the alias with its defined value The alias substitution occurs after the variable substitution For example if smyvariable is set to dir and dir is aliased to 1s entering smyvariable in the command line will cause the 1s command to be executed Like variable substitution alias substitution is not recursive See Aliases in the Features chapter for more information on aliases 3 3 3 Valid Characters for Variable Names Any appearance of invalid characters in a variable name will cause the Shell to stop substituting and it will discard the current on the command line Only the following characters can be used in variable names e under
91. lication e If it does not find the application in the current directory it will search the path list that is stored in the path variable sequentially If it finds the application in one of the paths it stops searching and executes that application elf the path variable is empty or it does not exist it treats the current directory as the working directory e If it does not find the application in any of the paths it reports that the application was not found In general paths that are stored in the path variable look like the following 16 Features path s0 efi tools fs0 efi boot fs0 fs1 efi tools fs1 efi boot feds The EFI Shell supports both absolute paths and relative paths when executing commands Users can set path to any specified value but this variable will be refreshed immediately after the map r command is executed This variable is volatile so the contents will be lost after a reset or power off Typically users can append the paths to this variable in the following way set v path path fs0 test 2 3 6 KEY History Support The EFI Shell saves the history of commands that executed from a Shell prompt Press the up or down arrow key to recall the previous commands Note that the Shell will not save commands that are executed in batch scripts in the KEY history 2 3 7 Execution Interrupts 2 3 7 1 Execution Interrupt Support The EFI Shell supports interrupting the execution of the Shell c
92. lidate options on all devices Shell gt drvcfg v To validate options on all devices that are managed by driver 0x17 Shell gt drvcfg v 17 To validate options on device 0x28 that is managed by driver 0x17 Shell gt drvcfg v 17 28 To validate options on all child devices of device 0x28 that is managed by driver 0x17 Shell gt drvcfg v 17 28 c To validate options on child device 0x30 of device 0x28 that is managed by driver 0x17 1 0to7thRvw July 2005 87 EFI Shell User s Guide Commands Shell gt drvcfg v 17 28 30 To set options on device 0x28 that is managed by driver 0x17 Shell gt drvcfg s 17 28 To set options on child device 0x30 of device 0x28 that is managed by driver 0x17 Shell gt drvcfg s 17 28 30 To set options on device 0x28 that is managed by driver 0x17 in English Shell gt drvcfg s 17 28 1 eng To set options on device 0x28 that is managed by driver 0x17 in Spanish Shell gt drvcfg s 17 28 1 spa Shell gt 5 5 17 drvdiag Summary Invokes the Driver Diagnostics Protocol EFI Versions EFI 1 10 and above 88 Usage DRVDIAG c l XXX ChildHandle c 1 specified by XXX s e m DriverHandle DeviceHandle managing ChildHandle DeviceHandle Description Commands s e m DriverHandle DeviceHandle Diagnose all child devices Diagnose using the ISO 639 2 language Run Run Run The The The diagnostics in standard mod
93. lp is a one sentence description of the Shell command usage and verbose help is a detailed description of the usage of a Shell command including explanations of each switch and examples To display the verbose help information of an internal command type either of the following at the command prompt where cmd is the name of the internal command help cmd cmd Note The help cmd form can only be used with internal Shell commands To display all the line help information of all the internal Shell commands type the following at the command prompt help The help command supports wildcards in internal command names For example help d will display the line help information of all the internal commands whose names start with the character d See the Commands chapter for the detailed information for the help command For External Commands To display the verbose help information of an external Shell command type the following at the command prompt where cmd is the name of the external command This form does the same thing ashelp cmd cmd 6 16 How to Terminate the Execution of Commands Press the ESC key to terminate the execution of internal commands and batch scripts 6 17 How to Pause the Screen Output Press the Tab key to pause and resume the streaming of output characters to the console 1 0to7thRvw July 2005 141 EFI Shell User s Guide Shell How To s 6 18 How to View the Screen History
94. meaning of the quotation marks Escaping characters will be discarded after a command line has been processed assuming the escaping character was not escaped by another escaping character 138 Shell How To s 6 10 How to Alias Users can set aliases to commands Use the alias command to view set up and delete aliases See the following topics or chapters for more information on the following e The Aliases topic in the Features chapter for general information on aliases e The Commands chapter for the detailed help information for the alias command The following table gives examples of custom i e not predefined aliases It shows what to type at the command prompt to set the alias and then describes the result of that command Table 6 1 Examples of Custom Aliases Command to Type at Shell Prompt Result alias 11 ls b Sets 11 as the alias to the command 1s b alias v rmdir rm q Sets rmdir as the alias to the command rm _ q 6 11 How to Map a File System to a User Specific Mapping Name Use the map command to map a file system to a user specific mapping name For example you can map a file system that is represented by hdOa1 to a user specific name hdisk1 by typing the following at the command prompt map hdiskl hd0al Note that the last colon is required because the map command also supports mapping a user specific mapping name to a file system handle The colon eliminates the ambiguity of two usages If
95. n 98 Commands EFI Versions EFI 1 02 and above Usage LS r a attrib file r Displays recursively including subdirectories attrib a s h r d or combination of them a Archive s System h Hidden r Read only d Directory file Name of file directory wildcards are permitted Description This command lists directory contents or file information If no file name or directory name is specified then the current directory is assumed The contents of a directory are listed if all of the following are true e If option r is not specified e If no wildcard characters are specified in the file parameter e If ile represents an existing directory In all other cases the command functions as follows e All files directories that match the specified name are displayed e The r flag determines whether a recursive search is performed e The option flag a attrib tells the command to display only those files with the attributes that are specified by attrib If more than one attribute is specified only the files that have all those attributes will be listed If a is followed by nothing then all files directories are displayed regardless of their attributes If a itself is not specified then all files except system and hidden files are displayed 1 0to7thRvw July 2005 99 EFI Shell User s Guide Commands Examples Shell gt help 1s Displays a list of files and subdirectories in a di
96. n Red Magenta Yellow Light gray AYOUB WNHE O l Description This command clears the standard output device with an optional background color attribute If color is not defined then the background color does not change 58 Commands Examples Shell gt help cls Clears the standard output with an optional background color CLS color color New background color Black Blue Green Cyan Red Magenta Yellow Light gray YAYou Bh WNE O Note 1 If no parameters are specified this command clears the standard output device The background color is not changed Examples To clear the output but not change the background color fs0 gt cls To clear the output and change the background color to Cyan fs0 gt cls 3 To clear the output and change the background with default color black fs0 gt cls 0 Shell gt 5 5 7 connect NoTE This command is an internal only command It cannot be switched to an external command Summary Binds a driver to a specific device and starts the driver EFI Versions EFI 1 10 and above 1 0to7thRvw July 2005 59 EFI Shell User s Guide Commands Usage CONNECT DeviceHandle DriverHandle c r r Connect recursively c Connect console devices described in the EFI Environment Variables DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always take
97. n as hexadecimal number Description This command binds a driver to a specific device and starts the driver If the r flag is used then the connection is done recursively until no further connections between devices and drivers are made If the c flag is used then the connect command will bind the proper drivers to the console devices that are described in the EFI environment variables The example below shows the typical output from the verbose help for this command 60 Commands Examples Shell gt help connect Binds an EFI driver to a device and starts the driver CONNECT DeviceHandle DriverHandle c r r Connect recursively c Connect console devices described in the EFI Environment Variables DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always taken as hexadecimal number Note 1 When option c is specified only console devices described in the EFI Environment Variables and related devices will be connected 2 If recursive option r is specified it causes EFI to scan all handles and checks to see if any loaded or embedded driver can match the specified device If so the driver will be bound to the device Additionally if more device handles are created during the binding these handles will also be checked to see if a matching driver can bind to these devices as well The process is repeated until no more drivers are able to
98. n change A hardware configuration change is any change in the number of or physical connections of a device that has the capability to produce child devices Hardware configuration changes have global scope effects Any hardware configuration change could possibly nullify the existing consistent mapping names If the hardware configuration remains consistent all the consistent mapping names will remain consistent This constancy reflects two characteristics of consistent mapping e Outside of hardware configuration changes all the consistent mapping names will be kept the same e Systems that have exactly the same hardware configuration should have exactly the same consistent mapping names The second characteristic is very useful for users to write scripts that will be executed across multiple systems that have exactly the same hardware configuration It guarantees consistent access to file systems in the scripts Consistent mapping names are different and typically a little longer than traditional sx style file system names A GUIDed file system may have a consistent mapping name that may have more than 64 characters For users who work with the command prompt traditional f sx style mapping names are still the norm Keep in mind that if you are using the sx style map names on the command prompt they do not have consistent mapping characteristics How to Switch the Running Modes of the EFI Shell To be backward compatible to older
99. na tench a a E Wheres Toca AERE Cathe 22 3 3 Variable and Alias Substitution wis iccessstuaceesscantadeteestendens vaaetveaeasnsadssaaletigtesasaniendeeaionsesd 23 3 3 1 Environment Variables and Variable Substitution 0 eceeeeeeeeeeeeeeeeeees 23 3 3 2 PAS OGURA ON srs 2 dees hate tas gazes E cists aa text eas Wack nedehnien ecwedeae E catckgen ated 23 3 3 3 Valid Characters for Variable Names cecceceeeeeeeeeeeeeeeeeeeneeeeeeeaeeeeees 23 3 3 4 Variables Available Only in Batch Scripts cccceccceeeeseeeeeeeeneeeeeeenneeeeees 23 3 3 5 special Shell Variables sicccicsccci cee casstscagcdensneraneudehentanasthacspdastaleadaeneeenenanielens 24 3 3 6 Variable Substitution Flowchart sscsccseiccsecechenoed ctaet waves tadendanionees tne eee 25 34 WIGAN EXPANSION 2a cesx Gnas dea tetas wits ara aa tual ch kai Ta wage dal YOLE A RE ARNE dita Meads cand cdeane 27 1 0to7thRvw July 2005 Vv EFI Shell User s Guide 3 5 Switches and Arguments in COMMANAS cccecceceeeeecceeeeeeeaeeeeeeeeaeeeseeeeeeeeeeeeeeees 27 BOs AMOTAM OM IAT Aee EE EA E E TE AE sak taas seacshuaaster anomneneedue arta pent oea has de 28 S7 o QUIPUL OCS CUOMA cous ceteci is emis as tet s aca tbe sit tence ct ahaa et cates s dete Seach at E 29 3 8 File Naming Conventions iccseccctssssvoeeedsveds can hietnigeddedoccunastsacvees dudendeenyedt ceseenstbuenseeetseaeds 30 4 SE Ce pod S r a a a parai Pe See ee ee ene Deere aa Serer eeeree eer e
100. nch and Exit the EFI Shell Launching or Invoking the EFI Shell The EFI Shell can be launched in the following three ways e Launched as a default boot option e Loaded and launched from the boot option maintenance menu as an application e Loaded and launched from the EFI Shell command prompt as an application The EFI Shell can be built as part of the firmware and will be added as a default boot option at boot time Exiting the EFI Shell The exit command is provided to let users exit the EFI Shell Because the EFI Shell supports nesting the Shell the exit command will exit the current instance of the EFI Shell and return to its parent If there is no parent EFI Shell it should go back to the EFI boot manager or the boot option maintenance menu In batch scripts the exit command will terminate the entire EFI Shell not only the scripts 6 14 How to Determine the Version of the EFI Shell Use the ver command to display the version information of the firmware and the EFI Shell To display the version of the firmware type the following at the command prompt ver To display the version of the EFI Shell type the following at the command prompt ver s See the Commands chapter for the detailed help information for the ver command 140 Shell How To s 6 15 How to Get Help Information For Internal Commands Use the help command to display the line help and the verbose help information of internal Shell commands Line he
101. not echoed to the console regardless of whether the echo state is on or off Error Handling By default if an error is encountered during the execution of a command in a batch script the script will continue to execute However if an error is encountered that affects the logic of the script when executing the script only commands such as for endfor if else endif and goto the script will exit If the error causing script is called by another script the caller script will continue to execute 1 0to7thRvw July 2005 43 EFI Shell User s Guide Batch Scripts The lasterror Shell variable is provided to allow batch scripts to test the results of the most recently executed command using the if command This variable is not an environment variable it is a special variable that the Shell maintains for the lifetime of the current instance of the Shell It is a read only variable and cannot be modified by the command set Script only commands which are used to control the logic of the script do not affect the value of the lasterror variable 4 6 Running Modes in Batch Scripts The running mode will always be set to backward compatible mode at the beginning of execution of a batch script file no matter what mode the Shell was in before the script is executed As a result it is the user s responsibility to have the script set the running mode to the proper mode for its purpose See the topics that are listed in the table below for mor
102. ns wildcards it will not ask the user for confirmation 5 You cannot remove the root directory 6 You cannot remove thecurrent directory or its ancestor 7 Redirecting output to a file that exists under the directory that will be removed is not allowed Examples To remove multiple directories at a time fs0 gt 1s test Directory of fs0 test 06 18 01 01 01p lt DIR gt 512 06 18 01 01 01p lt DIR gt O 26 06 19 01 12 59a lt DIR gt 512 templ 06 19 01 12 59a lt DIR gt 512 temp2 0 File s 0 bytes 4 Dir s Error occurs and DEL will exit fs0 gt del test temp11 temp2 rm del Cannot find fs0 test temp11 Not Found To remove multiple directories with wildcards s0 gt del test temp rm del Remove subtree fs0 test temp1 y n y 72 Commands removing fs0 test temp1 temp1 txt ok removing fs0 test temp1 boot nshell efi ok removing fs0 test temp1 boot ok removing fs0 test temp1 ok rm del Remove subtree fs0 test temp2 y n y removing fs0 test temp2 temp2 txt ok removing fs0 test temp2 ok Removing a directory that contains a read only file will fail fs0 gt attrib r test templ1 readme txt A R fs0 test temp1 readme txt s0 gt del test templ rm del Cannot open readme txt under fs0 test templ in writable mode error Access Denied Exit status code Access Denied Shell gt 5 5 12 dh NoTE This command is an
103. nternal Commands Supported EFI Command Version Description alias EFI 1 02 and above Displays creates or deletes aliases in the EFI Shell attrib EFI 1 02 and above Displays or changes the attributes of files directories cd EFI 1 02 and above Displays or changes the current directory cls EFI 1 02 and above Clears the standard output with a background color connect EFI 1 10 and above Binds an EFI driver to a device and starts the driver copy EFI 1 02 and above Copies one or more files directories to another location cp EFI 1 02 and above Copies one or more files directories to another location date EFI 1 02 and above Displays the current date or sets the date in the system del EFI 1 02 and above Deletes one or more files or directories dh EFI 1 10 and above Displays the handles in the EFI environment 1 0to7thRvw July 2005 49 EFI Shell User s Guide dir disconnect drivers drvcfg drvdiag echo exit help 2 load Is map mkdir kk mv reconnect reset rm set time touch type unload ver vol EFI 1 02 and above EFI 1 10 and above EFI 1 10 and above EFI 1 10 and above EFI 1 10 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 10 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 10 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above EFI 1 02 and above
104. o Edit a Binary File An application hexedit is provided along with the EFI Shell to allow users to edit binary files To launch the hexedit application type the following at the command prompt hexedit Type the following at the command prompt for detailed help information for the hexedit command 142 Shell How To s hexedit 6 23 How to Edit Disk Blocks There are two applications that can be used to view and edit disk blocks edblk ehexedit Type the following at the command prompt for the detailed help information for these two applications dblk hexedit 6 24 How to Edit Memory Use the external mm command to edit bytes in specific memory locations Type the following at the command prompt to get the detailed help information for the mm command mm 6 25 How to Connect a Driver to a Device Use the connect command to connect a single driver to a specific device or to connect all the drivers to all the devices See the Commands chapter for detailed help information for the connect command 1 0to7thRvw July 2005 143
105. ommands and scripts There are two kinds of execution interrupts which are described in more detail in the next topics Script execution interrupts Internal command execution interrupts 2 3 7 2 Script Execution Interrupt Press the ESC key to interrupt the execution of a batch script The interrupt can happen only between commands that are included in the batch script The batch script supports the nesting of the script Once a script is interrupted all its predecessor scripts are also interrupted 2 3 7 3 Internal Command Execution Interrupt Press the ESC key to interrupt the execution of time consuming EFI Shell internal commands for example 1s _ r These EFI Shell commands implement the interrupt mechanism by themselves 1 0to7thRvw July 2005 17 EFI Shell User s Guide Features Currently the EFI Shell core does not support interrupting the execution of commands or applications all by itself It requires that the commands or applications be able to detect interruptions 2 3 8 Consistent Mapping of File Systems This version of the EFI Shell adopts a new rule called consistent mapping for file system mappings Under this rule names of file system mappings will not change in either of the following scenarios e After a reboot e After the map _ r command if the hardware configuration does not change If two or more computers have the same hardware configuration the results of the consistent mapping on these computer
106. or Variable The Shell also defines a special variable named lasterror that is valid only in scripts See Special Shell Variables for more information 3 3 5 Special Shell Variables The Shell maintains the following three special variables which are described in the table below epath elasterror eefishellmode eStartupDelay Table 3 3 Special Shell Variables Variable Description path Contains the default directories that may exist on all the discovered file systems These 24 Syntax default directories are the root directory e i tools and efi boot If the Shell cannot find the script or application under the current directory it will search the directories that are referred by this variable when users execute a script or an application For more information on this variable see PATH Variable Support in the Features chapter lasterror Contains the return code of the most recently executed Shell command This variable is valid only in scripts and cannot be set by users Its name space is separate from that of an environment variable Script only commands such as if for else and goto which are used to control the logic of the script do not change the value of lasterror efishellmode A reserved volatile environment variable that is used to determine or specify the current running mode backward compatible mode enhanced Shell mode or a newer mode in a future version of the EFI Shell Users can specify a value for th
107. p cp copy cp date date date del del rm dh dir dir dir disconnect drivers drvcfg drvdiag echo echo echo exit exit exit help help load Is dir Is map mkdir mkdir mkdir mv move mv reconnect reset reset reboot rm del rm 48 Commands set set set time time time touch touch type type type unload ver ver vol vol 5 5 Internal Command Descriptions 5 5 1 Summary of EFI Shell Internal Commands The EFI Shell core integrates some internal commands The table below lists all the internal EFI Shell commands that are supported The following topics describe each command in more detail Because there are some fundamental differences between different EFI implementations some of the commands cannot run across all implementations The table indicates the versions of EFI that are supported for each respective command If you run a command that is not supported on a system the command should quit gracefully with a message In the table below a double asterisk indicates that the command is an internal only command it cannot be switched to an external command or application See the External Commands topic in this chapter for more information All of the Shell commands listed below support the b flag This flag tells the command to display one screen at a time Because it is a default flag that is available in all commands it is not listed in the commands syntax or help information Table 5 3 EFI Shell I
108. plication You will need to write an inf file for your external command or application See the EFI Shell Developer s Guide for instructions on how to write an inf file for external commands or applications Remove the lines for the previous internal command from the she11 inf file which is located under the EFI Shell source root directory Remove the declarations of the entry point function and line help function from shell shellenv cmddisp c Remove the entry for the previous internal command from the SEnvInternalCommands table 134 Shell How To s NoTE 6 4 6 5 Changing an internal only command to an external command is not permitted See the Commands chapter for the list of internal only commands How to Understand Consistent Mapping Consistent mapping was introduced in this version of the EFI Shell to provide the ability to map file systems to consistent mapping names that will change only if the system s hardware configuration changes Because what constitutes a hardware configuration change can be defined in several ways this document uses the following rules to determine if the hardware configuration has changed e The number of buses or controllers in a system has changed e The physical connections of buses or controllers in a system have changed e The physical connection of a device to the system has changed In general use the following as the definition of a hardware configuratio
109. r DeviceHandle Device handle always taken as hexadecimal number DriverHandle Driver handle always taken as hexadecimal number ChildHandle Child handle of device always taken as hexadecimal number r Reconnect drivers to all devices Note 1 This command disconnects the drivers from the controller just like DISCONNECT but it then immediately reconnects them recursively 2 If option r is specified any drivers that are binding to any devices will be disconnected first and then connected recursively 3 If no ChildHandle parameter is specified all child handles of the specified device will be the default 4 If no DriverHandle parameter is specified all drivers on the specified device will be the default 5 This command is a great way to test if drivers are following the EFI 1 10 Driver Model 6 This command does not support output redirection Examples To reconnect all drivers to all devices Shell gt reconnect r To reconnect all drivers to device 0x28 fs0 gt reconnect 28 To reconnect driver 0x17 to device 0x28 fs0 gt reconnect 28 17 To reconnect driver 0x17 to child 0x32 of device 0x28 fs0 gt reconnect 28 17 32 114 Commands Shell gt 5 5 27 reset Summary Resets the system EFI Versions EFI 1 02 and above Usage RESET w string RESET s string Ww Performs a warm reset s Performs a shutdown string String to be passed
110. r format s0 gt date 01 01 2050 fs0 gt date 01 01 2050 To set the date with short year format fs0 gt date 06 18 01 fs0 gt date 06 18 2001 Shell gt 5 5 11 del Summary Deletes one or more files or directories EFI Versions EFI 1 02 and above 70 Commands Usage DEL q file directory file directory q Quiet mode does not prompt user for a confirmation file File name wildcards are permitted directory Directory name wildcards are permitted Description This command deletes one or more files or directories If the target is a directory it will delete the directory including all its subdirectories It is not allowed to redirect a file whose parent directory or the file itself is being deleted 1 0to7thRvw July 2005 71 EFI Shell User s Guide Commands Examples Shell gt help del Deletes one or more files or directories DEL q file directory file directory Quite mode does not prompt user for a confirmation file File name wildcards are permitted directory Directory name wildcards are permitted Note 1 Removing a read only file directory will result in a failure Removing a directory containing read only file s will result failure 2 If an error occurs DEL will exit immediately and later files directories will not be removed 3 You cannot remove a directory when the current directory is itself or its subdirectory 4 If file contai
111. rectory LS r a attrib file r Displays recursively including subdirectories attrib a s h r d or combination of them a Archive s System h Hidden r Read only d Directory file Name of file directory wildcards are permitted Examples To hide files by adding the hidden or system attribute to them fs0 gt attrib s th efi ASH fs0 IsaBus efi ASH fs0 IsaSerial efi To display all except the files directories with h or s attribute fs0 gt 1s Directory of s0 06 18 01 09 32p 153 for nsh 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 testl 06 18 01 01 02p lt DIR gt 512 test2 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 01 28 01 08 24p r 29 readme txt 3 File s 211 bytes 4 Dir s To display files with all attributes in the current directory fs0 gt 1s a Directory of fs0 06 18 01 09 32p 153 for nsh 06 18 01 01 02p lt DIR gt 512 efi 06 18 01 01 02p lt DIR gt 512 test1 06 18 01 01 02p lt DIR gt 512 test2 06 18 01 10 59p 28 739 IsaBus efi 06 18 01 10 59p 32 838 IsaSerial efi 100 Commands 06 18 01 08 04p 29 temp txt 06 18 01 08 05p lt DIR gt 512 test 01 28 01 08 24p t 29 readme txt 5 File s 61 788 bytes 4 Dir s To display files with read only attributes in the current directory fs0 gt ls ar Directory of fs0 06 18 01 11 14p xr 29 readme txt 1 File s 29 bytes 0 Dir s To d
112. rib s efi To display attributes of all files directories in the current directory fs0 gt attrib attrib AS fs0 serial efi attrib DA fs0 testl1 attrib A HR fs0 bios inf attrib A s0 VerboseHelp txt attrib AS fs0 IsaBus efi To remove attributes of files using the a s h r option fs0 gt attrib r inf attrib AH f s0 bios inf 1 0to7thRvw July 2005 55 EFI Shell User s Guide Commands Shell gt 5 5 5 cd NoTE This command is an internal only command It cannot be switched to an external command Summary Changes the current working directory that is used by the EFI Shell environment EFI Versions EFI 1 02 and above Usage CD path path The relative or absolute file path Description This command changes the current working directory that is used by the EFI Shell environment The table below describes the conventions that are used to refer to the directory its parent and its driver mapping in the EFI Shell environment Table 5 4 Conventions for Directory Names Convention Description Refers to the current directory Refers to the directory s parent Refers to the root of the current driver mapping The following example shows how to move between the directories on a floppy drive containing an EFI directory and a TOOLS subdirectory below the EFT directory Commands Examples Shell gt help cd Displays or changes the current directory CD path p
113. rompt As a result you must place a statement at the beginning of the script to set the running mode to the desired setting This statement must be the first command in a script Note that scripts can be called inside scripts a feature that is referred to as nested batch scripts see Nesting Batch Scripts in the Batch Scripts chapter for more information Nested scripts should set and maintain the running mode for themselves However child scripts cannot change the running mode in the parent script To determine the current running mode scripts can read the reserved variable efishellmode the same as if they are reading a normal environment variable See Special Shell Variables in the Syntax chapter for more information on this variable How to Start a Specific startup nsh File When Launching EFI Shell The following steps explain how to start a specific start up batch script file startup nsh when you are launching the EFI Shell Ensure that the EFI Shell will be launched from a file system Currently the EFI Shell does not support starting a specific startup nsh file if the EFI Shell is launched from firmware Put the specific startup nsh file that you want to run in the same directory with the EFI Shell image that will be launched Note that the file name must be startup nsh case insensitive Load and execute the EFI Shell image The specified startup nsh file will then be executed unless the user cancels its execution 13
114. rong hour minute second range 2 Spaces before or after the numeric character are not allowed Spaces inserted into the number are not allowed either 3 Repeated zeros are allowed before the number For example 1 0to7thRvw July 2005 121 EFI Shell User s Guide Commands Shell gt time 00000017 000004 0000 Shell gt time 17 04 00 GMT 08 00 Shell gt 4 The seconds parameter is optional If there is no seconds number it will set to zero by default Shell gt time 17 23 Shell gt time 17 23 00 GMT 08 00 Shell gt time 17 23 Shell gt time 17 23 00 GMT 08 00 Examples Shell gt help time Displays the current time or sets the time of the system TIME hh mm ss hh Hour of time hour range 0 23 mm Minute of time minute range 0 59 ss Second of time second range 0 59 Note 1 Hour and minute are required to set the time 2 If second is not specified 0 will be used as default Examples To display current time fs0 gt time 16 51 03 GMT 08 00 To set the system time fs0 gt time 9 51 30 fs0 gt time 09 51 31 GMT 08 00 Shell gt 5 5 31 touch Summary Updates the time and date on a file to the current time and date 122 Commands EFI Versions EFI 1 02 and above Usage TOUCH r file file r Recursive to subdirectories file The name or pattern of the file or directory There can be multiple files on the command line Description T
115. rror only when the value of a is also a single alphabet letter If two independent for commands use the same index variable the first for has already freed the variable when the second for is encountered so there will be no problem in this case 4 2 3 goto NoTE This command is available only in batch script files Summary Makes the execution of the batch file jump to another location Usage goto label Description The goto command directs the batch file to execute the line in the batch file after the given label This command is not supported from the interactive Shell A label is a line beginning with a colon It can appear either before or after the goto command The Shell searches forward in the batch file for 1abe1 from the current file position If it reaches the end of the file the search resumes at the top of the file and continues until it finds 1abe1 or it reaches the starting point If 1abe is not found the batch process terminates and the Shell displays an error message If a label is encountered but the goto command was not executed the label lines are ignored You cannot use the goto command to jump into another for loop but it is legal to jump into an if statement 34 Batch Scripts Examples This is a batch script goto Done Done cleanup nsh 4 2 4 if else endif NoTE This command is available only in batch script files Summary Executes one or more commands depending on wh
116. s attempted Because b does not exist the will be discarded and b will be left Now launch the script without the command line argument fs0 gt set d 1 Argvar gt echo off Output EnvVarAb This time 1 does not exist and 1 becomes undefined The next check will then be a and a will be substituted with EnvVarA The resulting string then looks like EnvVarAb Now delete another environment variable a and try the script fs0 gt set d a fs0 gt ArgVar Argvar gt echo off Output IndexVarAb In the previous example 1 is replaced with an empty string Then the second is met Because a also is not defined the index variable a is attempted which will find a match Thus a is replaced with IndexVarA Then the remaining b takes the form x but matches nothing so the is discarded The argument and variable substitution is a single circular process so if the value of a positional argument contains an environment variable Svar and regardless of whether Svar is defined when the script is launched the argument will be replaced with the literal string tvar After the arguments and variables are substituted the Shell examines the first argument to see if it is an alias name If so the alias name is replaced with its value Comments Comments can be embedded in batch scripts The character on a line is used to denote that the Shell is to ignore all characters on the same line and to the right of the Comments are
117. s document or that might be useful in understanding the descriptions presented in this document See the references sections in the EFI 1 10 Specification and in the in the EFI Documentation help system for a complete list of the additional documents and specifications that are required or suggested for interpreting the information presented in this document The EFT 1 10 Specification is available from the EFI web site http developer intel com technology efi The EFI Documentation help system is available from the EFI web site http developer intel com technology efi help efidocs htm 12 2 Features 2 1 Shell Features Introduction This section provides information on the various features of the EFI Shell The EFI Shell is a simple interactive environment that allows users to do the following e Load EFI device drivers e Launch EFI applications e Boot operating systems e Use a set of basic commands to manage files system environment variables and other elements of EFI The EFI Shell provides an environment that can be modified to easily adapt to many different hardware configurations The EFI Shell supports the following e A command line interface eA set of Shell internal commands and external commands e Batch scripting 2 2 Shell Appearance The figure below shows what the device mapping table looks like in the EFI Shell GUI 13 EFI Shell User s Guide Features Current running mode 1 1 2 UnknownDev ic
118. s into the sources common section of she11 inf which is located under the EFI Shell source root directory to include all the source files of your external command If your external command uses any uni files they should be included here and must be put ahead of any c files of your command For example Hello HelloString uni Hello Hello c If your external command or application uses any h files please add lines into the includes common section to indicate where the h files can be found e g the file Hello h is under C EDK Other Maintained Application Shell Hello EDK_SOURCE Other Maintained Application Shell Hello The macro EDK_SOURCE represents the EDK root directory It should be followed by the relative path from the root where the h files can be found In the file she11 shellenv cmddisp c declare the entry point function and line help function of your external command ahead of the SEnvInternalCommands table Add an entry for your external command into the SEnvInternalCommands table using the following values in the order listed e Entry point function e Internal command name e Line help function You must add the entry inside the ifdef EFI_MONOSHELL endif block Build the EFI Shell Your external command should then have been added as an internal command How to Switch an Internal Command to an External Command The following steps explain how to switch an internal command to an external command or ap
119. s not allowed Examples To create a new directory fs0 gt mkdir rafter fs0 gt 1s Directory of s0 06 18 01 06 18 01 06 18 01 08 05p lt DIR gt 11 14p 11 50p lt DIR gt 1 File s 2 Dir s 512 test 29 readme txt 512 rafter 211 bytes To create multiple directories fs0 gt mkdir templ temp2 fs0 gt 1s Directory of fs0 06 18 01 08 05p lt DIR gt 06 18 01 11 14p 06 18 01 11 50p lt DIR gt 06 18 01 11 52p lt DIR gt 06 18 01 11 52p lt DIR gt 1 File s 4 Dir s Shell gt 1 0to7thRvw July 2005 512 test 29 readme txt 512 rafter 512 templ 512 temp2 211 bytes 109 EFI Shell User s Guide Commands 5 5 25 mv Summary Moves one or more files to a destination within a file system EFI Versions EFI 1 02 and above Usage MV src src dst src Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Description This command moves one or more files to a destination within a file system Moving between file system volumes is not supported If the destination is an existing directory then the sources are moved into that directory Otherwise the sources are moved to the destination as if the directory has been renamed If a destination is not specified the current directory is assumed to be the destination 110 Commands Examples Shell gt help mv Moves one or more files directories to des
120. s should be exactly the same Hardware configuration changes are defined as a change to the controllers or physical interfaces to which the devices are connected If you used an older version of the Shell that used the sX notation style for mapping file systems then the new consistent mapping convention might look a little different For example a GUIDed file system may have a consistent mapping name as f0agonennapphibbndlnmeaakamjeafdnb They are provided to deliver the capability of consistent mapping The old sX style mapping names will be kept in this version of EFI Shell to facilitate the use of mapping names on the command line but they do not have the consistent mapping characteristics If you need to use mapping names that are consistently mapped please do not use the old sX style mapping names The consistent mapping rule applies only to file system mappings It does not apply to block I O mappings 2 3 9 Output Redirection The output of EFI Shell commands can be redirected to Unicode or ASCII text files See the following for more information e Output Redirection in the Syntax chapter e Output Redirection in Batch Scripts in the Batch Scripts chapter 2 3 10 Output Streaming Control The EFI Shell supports pausing and resuming the streaming of characters to the output device Press the Tab key to pause and resume the output results that are produced by the current running commands or applications This feature is e
121. s true only in enhanced Shell mode Besides environment variables there are positional variables and index variables that can be used only in batch scripts As a result variable substitution in scripts is more complicated See the Variable Substitution Flowchart in the Syntax chapter for the searching sequence for variable substitution 4 3 4 General Command Line Variable Substitution Rule in Batch Scripts NoTE This rule is true only in enhanced Shell mode Command line variable substitution in batch scripts is simple because it does not have to consider index variables and positional variables Command line variable substitution deals only with environment variables For environment variables the syntax is svar where var is a valid variable name and should be included between two characters If the command line interpreter finds an environment variable whose name is var it will substitute the Svar string with the content that is defined by the variable If the command line interpreter cannot find any environment variable whose name is var then it will substitute the svar string with an empty string Variable substitution is not recursive which means that the content that is extracted from a variable will not be further interpreted as a variable 1 0to7thRvw July 2005 41 EFI Shell User s Guide Batch Scripts 4 3 5 Supported Number of Arguments in Batch Scripts NoTE This rule is true only in enhance
122. score e The digits 0 through 9 e Lowercase letters a through z e Uppercase letters A through Z 3 3 4 Variables Available Only in Batch Scripts This topic describes the following variables which are available only in batch scripts 1 0to7thRvw July 2005 23 EFI Shell User s Guide Syntax e Index and positional variables e lLasterror variable See the Batch Scripts chapter for more information on batch scripts Index and Positional Variables In scripts you can access two other kinds of variables which are described in the table below e Index variables e Positional variables Table 3 2 Index and Positional Variables Denoted Variable By Required Syntax Description Index SX Any alphabet Used in for loops This variable is valid only within the character from for statement in which it is defined ato zorAtoZ Positional on Digit between 0 Refers to the arguments that are specified on the and 9 command line with the script Up to ten positional arguments are supported for batch scripts Positional arguments are substituted before each line in the script file is executed By convention 0 is the name of the script file that is currently being executed See Variable Substitution Flowchart for the substitution rule in scripts To delimit an index variable or positional variable use a before the variable name For example a will delimit the content of index variable a as well as the positional variable Lasterr
123. specially useful for commands and applications that may produce a large number of output results 18 Features 2 3 11 Scroll Back Buffer Support The EFI Shell supports scrolling the output buffer back and forward so that consoles can have a screen history Press the Page Up and Page Down keys to scroll back and forward in the screen history and press any other key to quit scrolling However you cannot scroll through the screen history while a command application or script is being executed The text output history is limited to a maximum of three screens 2 3 12 Verbose Help Support The EFI Shell supports verbose help for each command Type either help cmd or cmd to get detailed help information for that command See the help command description in the Commands chapter for more details There are two levels of help information which are listed in the following table Table 2 2 EFI Shell Command Help Information Level Level Description Line help Describes the Shell command usage in one sentence Verbose help Describes the Shell command usage in detail including explanations of each switch and examples The help information is built into the EFI Shell image If you need help support for a customized internal command the command has to process the flag The command should print its verbose help information when it sees this flag See the EFI Shell Developer s Guide for details 2 3 13 EFI Compatibility of the
124. statements which can easily lead to errors e Do not reference the index value outside of the for statement that defines it e Do not use continue and break which are unsupported to begin the next iteration or quit a loop Use the goto command to control the execution flow if necessary Note that there is a Shell command called break but it is for debug purposes only and is not documented in this user s guide e Do not use the exit command to quit the current script This command will quit the entire EFI Shell 1 0to7thRvw July 2005 45 5 1 5 Commands Introduction The EFI Shell environment provides a rich set of commands that extend and enhance the EFI Shell capability These commands can be used directly from a command prompt In addition users can combine and organize these commands into a batch file Batch files also called batch programs allow users to simplify routine or repetitive tasks see the Batch Scripts chapter for more information This chapter does the following e Briefly discusses external Shell commands e Lists the abbreviations that are used in the EFI Shell to indicate EFI protocol names e Lists the MS DOS 6 22 and Unix equivalent names for EFI Shell internal commands e Provides descriptions of all the Shell internal commands 5 2 External Commands 5 3 External commands are a set of Shell applications There is no difference between internal and external Shell commands and they can be switch
125. tch scripts and the script only commands 2 3 4 Nesting the Shell The EFI Shell supports nesting the Shell itself The EFI Shell can run the Shell from within itself The nesting level is determined by how much memory the system has The exit command exits the EFI Shell environment In a nested Shell this command will quit only the current Shell In scripts the exit command terminates the current Shell not the current script If the current Shell is a child Shell it will return to the parent Shell The newly launched Shell will have a brand new execution environment except for variables and aliases Internal Commands in a Nested Shell Different instances of the EFI Shell can have different sets of internal commands For example you can boot the system to an EFI Shell with the minimum set of internal commands and then you can load an EFI Shell with the expected built in internal commands at the Shell command prompt Users can dynamically change their internal command sets in this way and do not need to recompile their EFI Shell 2 3 5 PATH Variable Support The EFI Shell has a default volatile environment variable path which contains the default path that the EFI Shell will search if necessary When a user tries to launch an EFI application the Shell first searches for the application in the current directory and does the following e If it finds the application in the current directory it stops searching and executes that app
126. ted the review comments that received from Winters Did 8 25 04 not receive replies for all of my review questions so some are still included in this version 1 0_to7thRvw Incorporated review comments received from Fang amp Liu 7 6 2005 External Synchronized database 1 0to7thRvw July 2005 iii EFI Shell User s Guide iv Contents UW ay dvele LN Coad 01 a saanen ese sire reams tse aeaee re aeaaea me et snes Sasae aaneen 9 Til OVE W ea r bakin seuvaneaul bilan stack pekeoc R R E EE 9 1 2 Help System of This DOCUMCNMT 2 si ccsccassiecbecetsdanieteed denedevet oon cacteaeensacbidaes evankeveadecn sabe 9 Uae TeS a a a tas hac eed a A a eE 9 1 4 Conventions Used in This DoCUMENT c ccceeeeeeeeeeeeeeeeeeeeeaeeeetesaaeeeeeenaeeeenenneeees 10 1 4 1 Command Descriptions srren an aina aaa E a n RRE 10 1 4 2 Pseiido Code COnVeMmlOnS s 2008 ana ci red Roe es AA an joes 11 1 4 3 Typographic Conventlons sciceccvssheceess seaccdenes fedcelengetankssciuatesaehstuscevaueventeletaccaee 11 P gt 1 E E E ET 13 2 1 Shell Features Introduction ss ssosssseeeesnntesoerertetenntestttrnorrrnnrrtenteseernneernnnresrernseernn nnt 13 PAPAE EEA NOSITE lae ALO AEE E E EATE E T AE A A E E A dated 13 2 3 SUpport ed Feature S ieii eea a a a aa aar ER 14 2 3 1 SUPPOME Features s estire ates a tetar ie eeoa ASA DSE kepa SESS 14 2 3 2 EFEShellCommand Seene a a a satmyaee 15 2 3 3 Batch Scripts a A E RA 15 2 3 4 Nesting the S
127. the wildcard cannot prevent the wildcard from being expanded and can be either wildcard characters or literal file name characters The EFI Shell will first try to interpret them as wildcard characters to match files If any files are matched the Shell makes no further interpretation Otherwise the and characters will be considered as literal characters in file names The table below describes the wildcard expansion for the and characters Table 3 4 Wildcard Character Expansion Character Sequence Description Matches zero or more characters in a file name Matches exactly one character in a file name and Matches one character in a file name with one of the characters in and J 3 5 Switches and Arguments in Commands Most Shell commands take arguments after the command name that allow you to additionally specify what the command is supposed to do Some arguments are optional or required depending on the command The syntax for the command as listed in the command description in this document or in the verbose help for the command indicates the required format for any arguments The Shell and this document also use some specialized terms switch flag and option to indicate a subset of arguments These terms are used interchangeably and indicate an argument that begins with a or character The Shell will interpret this argument specially The following are some examples of arguments and switc
128. tination within fs MV src src dst sre Source file directory name wildcards are permitted dst Destination file directory name wildcards are not permitted Note 1 If dst is not specified then the current directory is assumed to be the dst 2 If there is more than one argument in the command line the last one will be taken as dst unconditionally If there is more than one source file directory to move the dst should be an existing directory 3 Attempting to move a read only file directory will result a failure 4 Moving a directory containing read only file s is allowed 5 You cannot move a directory into itself or its subdirectories 6 You cannot move a directory if current directory is itself or its subdirectory 7 Redirecting output to a file that exists under the directory that will be moved is not allowed 8 If an error occurs the remaining files or directories will still be moved Examples To rename a file fs0 gt mv IsaBus efi Bus efi moving fs0 IsaBus efi gt Bus efi ok To move a directory to the current directory fs0 gt mkdir test1 temp fs0 gt mv test1 temp moving fs0 test1l temp gt temp ok To rename a directory 1 0to7thRvw July 2005 111 EFI Shell User s Guide Commands fs0 gt mv efi efil 1 moving fs0 efi gt efil 1 ok To move multiple directories at a time fs0 gt mv test1 test2 test moving fs0 testl
129. txt ok removing fs0 test temp1 boot nshell efi ok removing fs0 test temp1 boot ok removing fs0 test temp1 ok rm del Remove subtree fs0 test temp2 y n y removing fs0 test temp2 temp2 txt ok removing fs0 test temp2 ok Removing a directory that contains a read only file will fail fs0 gt attrib r test templ1 readme txt A R fs0 test temp1 readme txt fs0 gt rm test templ rm del Cannot open readme txt under fs0 test templ1 in writable mode error Access Denied Exit status code Access Denied Shell gt 5 5 29 set NoTE This command is an internal only command It cannot be switched to an external command Summary Used to maintain the environment variables that are available from the EFI environment EFI Versions EFI 1 02 and above 118 Commands Usage SET v sname value SET d lt sname gt d Deletes the environment variable v Volatile variable sname Environment variable name value Environment variable value Description This command is used to maintain the environment variables that are available from the EFI environment This command can do the following e Display the environment variables e Create new environment variables e Change the value of existing environment variables e Delete environment variables The set command will set the environment variable that is specified by sname to value Th
130. versions of the EFI Shell for example the EFI Shell that was included in the EFI 1 10 14 62 Sample Implementation the new EFI Shell provides two running modes e Backward compatible mode e Enhanced Shell mode 1 0to7thRvw July 2005 135 6 6 6 7 1 EFI Shell User s Guide Shell How To s See Running Modes and Backward Compatibility Support in the Features chapter for more information on these running modes Enhanced Shell mode is the default running mode in this release of the EFI Shell To change the current running mode execute the following command at the Shell prompt set v efishellmode xxx In the above command e ishellmode is the reserved volatile variable that the EFI Shell uses to control the current running mode see Special Shell Variables in the Syntax chapter for more information on this variable xxx is the value for the running mode 1 1 1 is for backward compatible mode and 1 1 2 is for enhanced Shell mode Any other values are invalid in the current version How to Correctly Write Scripts in the New EFI Shell Two running modes are introduced in this version of the EFI Shell see Running Modes and Backward Compatibility in the Features chapter for more information e Backward compatible mode e Enhanced Shell mode When a batch script is started the default running mode is set to backward compatible mode This mode is different from the default running mode when you are at the command p
131. vice There is a postfix after the mapname Description This command is used to define a mapping between a user defined name and a device handle The most common use of this command is to assign drive letters to device handles that support a file system protocol Once these mappings are created the drive letters can be used with all the file manipulation commands The EFI Shell environment creates default mappings for all the device handles that support a recognized file system This command can be used to create additional mappings or it can be used to delete an existing mapping with the d option If the map command is used without any parameters all the current mappings will be listed If the v option is used the mappings will be shown with additional information about each mapped handle The r option is used to regenerate all the default mappings in a system this option is useful if the system configuration has changed since the last boot 102 Commands Each device in the system has a consistent mapping name If the hardware configuration has not changed the device s consistent mapping names do not change If two or more machines have the same hardware configurations the device s consistent mapping will be the same Use the c option to list all the consistent mapping names in the system The mapping name consists of digits and characters Other characters are illegal This command support wildcards You can use t
132. xt gt fs0 test temp txt ok copying fs0 isaBus efi gt fs0 test IsaBus efi ok To copy multiple directories recursively to another directory fs0 gt cp r testl test2 boot test copying fs0 testl gt fs0 test testl copying fs0 testi test1l txt gt fs0 test test1 test1l txt ok copying fs0 test2 gt fs0 test test2 copying fs0 test2 test2 txt gt fs0 test test2 test2 txt ok copying fs0 boot gt fs0 test boot copying fs0 boot shell efi gt fs0 test boot shell efi ok To see the results of the above operations fs0 gt 1s test Directory of fs0 test 06 18 01 01 01p lt DIR gt 512 06 18 01 01 01p lt DIR gt O as 01 28 01 08 21p lt DIR gt 512 testi 01 28 01 08 21p lt DIR gt 512 test2 01 28 01 08 21p lt DIR gt 512 boot 01 28 01 08 23p 29 temp txt 01 28 01 08 23p 28 739 IsaBus efi 2 File s 28 828 bytes 5 Dir s Shell gt 68 Commands 5 5 10 date Summary Displays and sets the current date for the system EFI Versions EFI 1 02 and above Usage DATE mm dd yylyy mm Month of date to be set Month range 1 12 dd Day of date to be set Day range 1 31 yyyy Year of date to be set Year range 1998 2099 Description This command displays and or sets the current date for the system If no parameters are used it shows the current date If a valid month day and year are provided then the system s date will be updated Detailed rul
Download Pdf Manuals
Related Search
Related Contents
Samsung GT-B7320L manual do usuário(Open) InLine 59990A mounting kit Crosley Radio CR40 User's Manual Hitachi CB 13F User's Manual Plextor PlexCombo 8/8/24-8U (PX-208U/SW) CD-RW/DVD Fagor 3FCA-68NFX User's Manual Copyright © All rights reserved.
Failed to retrieve file