1

So this is what I have so far in my batch file. What I'm looking to do, is take the file that is created from the last line, 'serialnumber.txt' and rename it to the actual serial number of the computer. Maybe using the 'wmic bios get serialnumber' in some way?

wmic csproduct get identifyingnumber > %~d0\serial2.txt
%WINDIR%\SYSTEM32\msinfo32.exe /report %~d0\info2.txt
copy /b %~d0\serial2.txt + %~d0\info2.txt %~d0\serialnumber.txt
Hackoo
  • 18,337
  • 3
  • 40
  • 70
D.Roden
  • 13
  • 3

1 Answers1

0

Related to the comment of SomethingDark you are looking for something like that :

How to save a logfile with the serial number of a computer ?

@echo off
Call :GetSerialNumber
echo %SerialNumber% & pause
%WINDIR%\SYSTEM32\msinfo32.exe /report "%~d0\%SerialNumber%.txt"
Start "" "%~d0\%SerialNumber%.txt"
Exit
::***********************************************
:GetSerialNumber
for /f "tokens=2 delims==" %%a in ('
    wmic csproduct get identifyingnumber /value
') do for /f "delims=" %%b in ("%%a") do (
    Set "SerialNumber=%%b" 
)
exit /b
::***********************************************
Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • (Honestly, if he had said yes to my question, I would have just found a duplicate and voted to close.) – SomethingDark Aug 30 '16 at 06:38
  • Thanks for the help, it worked beautifully. However, I'm also just discovering that I will need to have the machine serial number and part number somewhere within the content of the final text file. I know that the (wmic /namespace:\\root\wmi path MS_SystemInformation get SystemSKU) command will pull the machine part number and I know how to get the serial number, but I'm having issues getting them both in the content of the final txt file. – D.Roden Aug 30 '16 at 14:03