搜尋此網誌

2011年10月22日 星期六

EFI Shell commands -- COMP(根據位元去比較兩個檔案內容)

Compares the contents of two files on a byte for byte basis.

COMP [-b] file1 file2


    -b       - Display one screen at a time
    file1    - First file name  (directory name or wildcards not permitted)
    file2    - Second file name (directory name or wildcards not permitted)

Note:
    1. COMP will compare files in binary mode.
    2. COMP will exit immediately if the lengths of the compared files are
       different.
    3. COMP will exit if 10 differences encountered.

Examples:
  * To compare two files with different lengths:
    fs0:\> comp bios.inf legacy.inf
    Compare fs0:\bios.inf to fs0:\legacy.inf
    Difference #1: File sizes mismatch
    [difference(s) encountered]

  * To compare two files with the same contents:
    fs0:\> comp bios.inf rafter.inf
    Compare fs0:\bios.inf to fs0:\rafter.inf
    [no difference encountered]

  * To compare two files with the same length but different contents:
    fs0:\> comp bios.inf bios2.inf
    Compare fs0:\bios.inf to fs0:\bios2.inf
    Difference #1:
    File1: fs0:\bios.inf
     00000000: 5F                                               *_*
    File2: fs0:\bios2.inf
     00000000: 33                                               *3*
    Difference #2:
    File1: fs0:\bios.inf
     0000000C: 00 00 00 00                                      *....*
    File2: fs0:\bios2.inf
     0000000C: 25 32 03 03                                      *%2..*
    [difference(s) encountered]

4 則留言:

  1. 請問一下如果要寫Script,怎麼讓他自動判斷結果是相同或是不同.

    回覆刪除
    回覆
    1. if %1% == yes then
      echo "output:" %1
      endif

      fs0:\> test.nsh yes
      output: yes

      刪除
  2. 請問一下如果要寫Script,要怎麼讓他自動判斷他的結果是相同或不同, 有像Windows底下有errorlevel可以看返回值來確認一樣的指令嗎?

    回覆刪除