[SOLVED] How to get Multi-Line Strings

Discussion in 'Scripting' started by xinso, Oct 22, 2014.

  1. xinso

    xinso MDL Guru

    Mar 5, 2009
    4,242
    5,512
    150
    #1 xinso, Oct 22, 2014
    Last edited by a moderator: Apr 20, 2017
    MSDM.txt
    Code:
    OEM Activation Tool 3.0
    
    (c) Copyright 2011 Microsoft Corp.
    
    Version: 6.3.9600 
    
    The ACPI MSDM table:
    4d 53 44 4d 55 00 00 00 03 71 44 45 4c 4c 20 20 
      50 45 5f 53 43 33 20 20 00 00 04 06 41 53 4c 20 
      00 00 04 00 01 00 00 00 00 00 00 00 01 00 00 00 
      00 00 00 00 1d 00 00 00 42 48 33 52 4e 2d 42 37 
      46 44 4d 2d 43 37 57 47 54 2d 34 43 52 34 58 2d 
      36 43 4b 48 4d 
    
    
    The ACPI MSDM data :
      Signature:          MSDM
      Length:             85 (0x55)
      Revision:           3
      CheckSum:           0x71
      OEMID:              DELL  
      OEMTableID:         PE_SC3  
      OEMRevision:        0x6040000
      CreatorID:          ASL 
      CreatorRev:         262144
    
    
    The ACPI MSDM table in hex:
      01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
      1d 00 00 00 42 48 33 52 4e 2d 42 37 46 44 4d 2d 
      43 37 57 47 54 2d 34 43 52 34 58 2d 36 43 4b 48 
      4d 
    
    ACPI MSDM table payload: 
      Version:             1
      Type:                1
      DataLength:          29
      Partial Product Key: 6CKHM
    Step 1:
    Code:
    findstr /o .* MSDM.txt >MSDM.log
    MSDM.log
    Code:
    0:OEM Activation Tool 3.0
    26:(c) Copyright 2011 Microsoft Corp.
    63:
    65:Version: 6.3.9600 
    85:
    87:The ACPI MSDM table:
    109:4d 53 44 4d 55 00 00 00 03 71 44 45 4c 4c 20 20 
    159:  50 45 5f 53 43 33 20 20 00 00 04 06 41 53 4c 20 
    211:  00 00 04 00 01 00 00 00 00 00 00 00 01 00 00 00 
    263:  00 00 00 00 1d 00 00 00 42 48 33 52 4e 2d 42 37 
    315:  46 44 4d 2d 43 37 57 47 54 2d 34 43 52 34 58 2d 
    367:  36 43 4b 48 4d 
    386:
    388:
    390:The ACPI MSDM data :
    412:  Signature:          MSDM
    440:  Length:             85 (0x55)
    473:  Revision:           3
    498:  CheckSum:           0x71
    526:  OEMID:              DELL  
    556:  OEMTableID:         PE_SC3  
    588:  OEMRevision:        0x6040000
    621:  CreatorID:          ASL 
    649:  CreatorRev:         262144
    679:
    681:
    683:The ACPI MSDM table in hex:
    712:  01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
    764:  1d 00 00 00 42 48 33 52 4e 2d 42 37 46 44 4d 2d 
    816:  43 37 57 47 54 2d 34 43 52 34 58 2d 36 43 4b 48 
    868:  4d 
    875:
    877:ACPI MSDM table payload: 
    904:  Version:             1
    930:  Type:                1
    956:  DataLength:          29
    983:  Partial Product Key: 6CKHM
    1013:
    1015:
    1017:
    1020:
    
    Step 2:

    a.
    Code:
    for /f "tokens=2* delims=:" %%A in ('find /i "764:" MSDM.log') do set SEC1=%%A
    set PART1=%SEC1:~14,36%
    Code:
    42 48 33 52 4e 2d 42 37 46 44 4d 2d
    b.
    Code:
    for /f "tokens=2* delims=:" %%A in ('find /i "816:" MSDM.log') do set SEC2=%%A
    set PART2=%SEC2:~2,48%
    Code:
    43 37 57 47 54 2d 34 43 52 34 58 2d 36 43 4b 48
    c.
    Code:
    for /f "tokens=2* delims=:" %%A in ('find /i "868:" MSDM.log') do set SEC3=%%A
    set PART3=%SEC3:~2,2%
    Code:
    4d
    Result
    Code:
    echo %PART1%%PART2%%PART3%
    Code:
    42 48 33 52 4e 2d 42 37 46 44 4d 2d 43 37 57 47 54 2d 34 43 52 34 58 2d 36 43 4b
     48 4d
     
  2. ai20110304

    ai20110304 MDL Novice

    Jul 31, 2016
    2
    0
    0
    #2 ai20110304, Sep 14, 2016
    Last edited by a moderator: Apr 20, 2017
    :clap: studied . Thanks.
     
  3. Compo

    Compo MDL Member

    Mar 29, 2011
    137
    105
    10
    #3 Compo, Sep 14, 2016
    Last edited by a moderator: Apr 20, 2017
    If you didn't know the character offsets, this may be able to output the characters you need:
    Code:
    @Echo Off
    SetLocal EnableExtensions EnableDelayedExpansion
    For %%A In ($ i n _) Do Set "%%A="
    For /F "Delims=" %%A In ('FindStr/V [:.] MSDM.txt') Do Set "_=!_!%%A"
    For /F "Tokens=1*" %%A In ('FindStr/C:"Length:" MSDM.txt') Do (
    If Not Defined $ (Set $=%%B) Else (Set/A $-=%%B, i=%%B))
    For %%A In (%_%) Do (Set/A $-=1
    If !$! LSS 0 (If !$! GEQ -%i% (Set n=!n! %%A)))
    Echo(%n:~1%
    Timeout -1
    EndLocal
    Exit/B