Save second line of a command in the Prompt

1

I need to save the second line of a command in Windows CMD, when using WMIC, it returns the product key in the second line, showing any message in the first line. I need to store this line in a variable, to apply the SLMGR command.

Comando:<br>

wmic path softwareLicensingService get OA3xOriginalProductKey 

Mensagem de retorno:<br>
  

OA3xOriginalProductKey
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (Accurate   of this line)

Does anyone know how to do this ??

It takes only the first line doing this. I need only the second line containing the key, because slmgr only recognizes it, any other character will display an error.

    
asked by anonymous 22.08.2016 / 18:58

1 answer

1

Run the command at the MS-Dos prompt usually by adding > arquivo at the end of the command so that the system saves the output to that file, as follows:

wmic path softwareLicensingService get OA3xOriginalProductKey > saida.txt

Then read the text file and process the lines that interest you.

    
22.08.2016 / 19:54