How to compare the content of two files in EFI Shell

Viewed 446

I want to compare the content of two files in EFI Shell. I saved the content of pci 05 00 00 in lan-ref.txt

My script looks like this:

echo -off
fs0:

pci 05 00 00 -s 0 > lan.txt

if lan.txt == lan-ref.txt then
  reset
else
  echo "LAN not found"
endif

I know that the "if lan.txt == lan-ref.txt" is not going to work, I am looking for the correct line to achieve the desired functionality.

2 Answers

Like @prl suggests, combine the comp command and %lasterror%:

comp lan-text lan-ref.txt
if %lasterror% eq 0 then
  reset
else
  echo "LAN not found"
endif

%lasterror% is equivalent to %errorlevel% in .bat scripts or $? in bourne shells and derivatives.

comp lan-text lan-ref.txt 
if %lasterror% ==0 then 
  reset
else
   echo "LAN not found"
endif
Related