Step to UEFI Shell (3) ----获得命令行参数的方法

这里介绍如何获得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

《Step to UEFI Shell (3) ----获得命令行参数的方法》有3个想法

    1. The parameters is just for Shell Application. It's not a feature of UEFI. I don't think there will be a way to get parameters without thses protocols.

  1. 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.

发表回复

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