computing
  • 1

Piping Contents Of Serial Number Into Variable

  • 1

Hello,
I am trying to pipe the contents of :
wmic bios get serialnumber
and store it into a variable called %SERIAL%.
I’ve tried multiple variations of :
SET SERIAL | wmic bios get serialnumber and
SET SERIAL > wmic bios get serialnumber
but have not been able to make it work.
The final output of what I want is a file called C:\Temp\%SERIAL%.txt
with contents of the %MAC_ADDRESS%.
thanks,

Share

1 Answer

  1. As someone with Win7, I’m going to jump in here to speed things along:

    IVO: post what displayed
    Note: \n denotes CR/LF.

    SerialNumber          \n
    System Serial Number  \n
    

    Basically, there’s a blank line at the end:

    C:\>for /F "delims=" %j in ('wmic bios get serialnumber') do @echo set SERIAL=%j
    set SERIAL=SerialNumber
    set SERIAL=System Serial Number
    set SERIAL=

    How To Ask Questions The Smart Way

    • 0