这里介绍如何获得Shell下的命令行参数。关键代码很简单,如下:

EFI_STATUS
EFIAPI
ShellAppMain (
	IN	UINTN 	Argc,
	IN 	CHAR16	**Argv
)
{
UINTN 	i;

	Print (L"Total %d args\n",Argc);
	for (i=0;i<Argc;i++)
 	{
	  Print (L"Arg[%d]= %s \n",i,*(Argv+i));
	}
	return EFI_SUCCESS;
}

 

uefistep3

完整的代码 HelloWorld2

  1. zszszsz says:

    In edk2 , ShellPkg use EFI_SHELL_PARAMETERS_PROTOCOL (or EfiShellParametersProtocol) to transfer parameters to ShellCEntryLib.

    anyway I can just do what ShellCEntryLib do to get shell parameters.

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>