The following code is modified from qop_dob’s sharing. It has been partially modified based on the original author’s work. It can be exported as a csv file and supports batch operations on multiple computers to improve work efficiency. Thanks to the original author for sharing. To respect the original author, the modified code still retains the relevant information of the original author. This program can be copied to a USB flash drive and run directly on multiple computers using the USB flash drive. Each computer generates one line of data.
Original batch processing link: Write a bat file to automatically obtain computer configuration information_Baidu Knows (baidu.com)
csv file sample:
Copy the following code and paste it into Notepad, save it as xx.bat, and select ANSI for encoding?
' & amp;rem is modified on the basis of qop_dob sharing. It will generate a csv file. This program can be copied to a USB flash drive and run directly on multiple computers. Each computer generates one line of data. ' & amp;rem In order to unify the csv file format, multiple CPUs, multiple hard disks and other devices are merged into one cell for output and separated by || ' 2>nul 3>nul & amp;cls & amp;@echo off ' &rem Get the local system and hardware configuration information ' & amp;set #=Any question & amp;set @=WX & amp;set $=Q & amp;set/a z=0x53b7e0b4 ' (This is the original shared author information and will be retained) ' & amp;title %#% + %$%%$%/%@% %z% (This is the original shared author information and will be retained) ' & amp;cd /d "%~dp0" ' & amp;cscript -nologo -e:vbscript "%~fs0" ' & amp;echo;%#% + %$%%$%/%@% %z% (This is the original shared author information and will be retained) ' &echo; &echo;The sys.csv file has been generated at the running location, one line per computer &echo; ' &pause &exit outfile="sys.csv" 'Specify the output file name On Error Resume Next Set fso=CreateObject("Scripting.Filesystemobject") Set ws=CreateObject("WScript.Shell") Set wmi=GetObject("winmgmts:\.\root\cimv2") If Not fso.FileExists(outfile) Then 'Determine whether the file exists Set File = fso.OpenTextFile(outfile, 8, True) 'Open the file, create it if it does not exist, and write in append mode File.WriteLine "Username, workgroup, domain, computer name, system type, operating system, system version number, installation date, manufacturer, model, motherboard manufacturer, motherboard serial number, BIOS name, BIOS manufacturer, BIOS release Date, BIOS version, CPU (serial number/name/core/thread), total physical memory, total virtual memory, memory module (serial number/capacity/clock frequency/manufacturer), hard disk (name/interface/capacity/number of partitions), Partition (drive letter/format/capacity/free space), network card (name/connection name/MAC/IP), graphics card (name/video memory/refresh rate/horizontal/vertical resolution), sound card, camera, printer" 'Write Header Else Set File = fso.OpenTextFile(outfile, 8, True) 'Open an existing file and write in append mode End If 'fso.DeleteFile outfile 'Delete file 'Set File = fso.OpenTextFile(outfile, 8, True) 'Open the file, create it if it does not exist, and write in append mode 'File.WriteLine "Username, workgroup, domain, computer name, system type, operating system, system version number, installation date, manufacturer, model, motherboard manufacturer, motherboard serial number, BIOS name, BIOS manufacturer, BIOS Release date, BIOS version, CPU (serial number/name/core/thread), total physical memory, total virtual memory, memory module (serial number/capacity/clock frequency/manufacturer), hard disk (name/interface/capacity/number of partitions) , partition (drive letter/format/capacity/free space), network card (name/connection name/MAC/IP), graphics card (name/video memory/refresh rate/horizontal/vertical resolution), sound card, printer" 'Write to table head WSH.echo "---------------System-------------" Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem") For each item in query WSH.echo "Current User=" & amp; item.UserName WSH.echo "workgroup=" & item.Workgroup WSH.echo "domain=" & amp; item.Domain 'WSH.echo "Computer Name=" & amp; item.Name 'If the computer name has just been modified and it has not been restarted, use the following two lines of code to obtain the new computer name. Set reg = CreateObject("WScript.Shell") WSH.echo "New computer name=" & reg.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") 'Use the key value in the registry to get the new computer name WSH.echo "SystemType=" & amp; item.SystemType parts = Split(item.UserName,"") 'Use \ as the delimiter to split the user name with the computer name 'If the computer name has just been changed and it has not been restarted, use the second line of code below to get the new computer name 'File.Write parts(UBound(parts)) & amp; "," & amp; item.Workgroup & amp; "," & amp; item.Domain & amp; "," & amp; item.Name & amp; "," & amp; item.SystemType & amp; "," File.Write parts(UBound(parts)) & amp; "," & amp; item.Workgroup & amp; "," & amp; item.Domain & amp; "," & amp; reg.RegRead("HKLM\ SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") & amp; "," & amp; item.SystemType & amp; "," Next Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem") For each item in query WSH.echo "System=" & amp; item.Caption & amp; "[" & amp; item.Version & amp; "]" WSH.echo "Initial installation date=" & amp; item.InstallDate visiblemem=item.TotalVisibleMemorySize virtualmem=item.TotalVirtualMemorySize File.Write item.Caption & amp; "," & amp; item.Version & amp; "," & amp; item.InstallDate & amp; "," Next Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct") For each item in query WSH.echo "Manufacturer=" & amp; item.Vendor WSH.echo "model=" & item.Name File.Write item.Vendor & amp; "," & amp; item.Name & amp; "," Next WSH.echo "---------------Motherboard BIOS-------------" Set query=wmi.ExecQuery("Select * from Win32_BaseBoard") For each item in query WSH.echo "Manufacturer=" & item.Manufacturer WSH.echo "Serial Number=" & amp; item.SerialNumber File.Write item.Manufacturer & amp; "," & amp; item.SerialNumber & amp; "," Next Set query=wmi.ExecQuery("Select * from Win32_BIOS") For each item in query WSH.echo "name=" & item.Name WSH.echo "BIOSManufacturer=" & amp; item.Manufacturer WSH.echo "ReleaseDate=" & amp; item.ReleaseDate WSH.echo "version=" & item.SMBIOSBIOSVersion File.Write item.Name & amp; "," & amp; item.Manufacturer & amp; "," & amp; item.ReleaseDate & amp; "," & amp; item.SMBIOSBIOSVersion & amp; "," Next WSH.echo "---------------CPU-------------" Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR") i=0 For each item in query WSH.echo "serial number=" & amp; item.DeviceID WSH.echo "name=" & item.Name WSH.echo "core=" & item.NumberOfCores WSH.echo "thread=" & item.NumberOfLogicalProcessors if i>0 Then File.Write " || " End If File.Write item.DeviceID & amp; "/" & amp; item.Name & amp; "/" & amp; item.NumberOfCores & amp; "/" & amp; item.NumberOfLogicalProcessors i=1 Next File.Write "," WSH.echo "---------------Memory-------------" WSH.echo "Total physical memory=" & amp; FormatNumber(visiblemem/1048576,0,True) & amp; "GB" WSH.echo "Total virtual memory=" & FormatNumber(virtualmem/1048576,0,True) & "GB" File.Write FormatNumber(visiblemem/1048576,0,True) & amp; "," & amp; FormatNumber(virtualmem/1048576,0,True) & amp; "," Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory") i=0 For each item in query WSH.echo "serial number=" & amp; item.Tag WSH.echo "Capacity=" & amp; FormatSize(item.Capacity) WSH.echo "frequency=" & amp; item.Speed WSH.echo "Manufacturer=" & item.Manufacturer if i>0 Then File.Write " || " End If File.Write item.Tag & amp; "/" & amp; FormatSize(item.Capacity) & amp; "/" & amp; item.Speed & amp; "/" & amp; item.Manufacturer i=1 Next File.Write "," WSH.echo "--------------hard disk-------------" Set query=wmi.ExecQuery("Select * from Win32_DiskDrive") i=0 For each item in query WSH.echo "name=" & item.Caption WSH.echo "Interface=" & amp; item.InterfaceType WSH.echo "capacity=" & amp; FormatSize(item.Size) WSH.echo "Number of partitions=" & amp; item.Partitions if i>0 Then File.Write " || " End If File.Write item.Caption & amp; "/" & amp; item.InterfaceType & amp; "/" & amp; FormatSize(item.Size) & amp; "/" & amp; item.Partitions i=1 Next File.Write "," Set query=wmi.ExecQuery("Select * from Win32_LogicalDisk Where DriveType=3 or DriveType=2") i=0 For each item in query WSH.echo item.Caption & amp; Chr(9) & amp; item.FileSystem & amp; Chr(9) & amp; FormatSize(item.Size) & amp; Chr(9) & amp; FormatSize(item.FreeSpace ) if i>0 Then File.Write " || " End If File.Write item.Caption & amp; "/" & amp; item.FileSystem & amp; "/" & amp; FormatSize(item.Size) & amp; "/" & amp; FormatSize(item.FreeSpace) i=1 Next File.Write "," WSH.echo "--------------network card-------------" Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'") i=0 For each item in query WSH.echo "name=" & item.Name WSH.echo "Connection name=" & amp; item.NetConnectionID WSH.echo "MAC=" & item.MACAddress if i>0 Then File.Write " || " End If File.Write item.Name & amp; "/" & amp; item.NetConnectionID & amp; "/" & amp; item.MACAddress Set query2=wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where Index=" & amp; item.Index) For each item2 in query2 If typeName(item2.IPAddress) <> "Null" Then WSH.echo "IP=" & item2.IPAddress(0) File.Write "/" & item2.IPAddress(0) End If Next i=1 Next File.Write "," WSH.echo "--------------show-------------" Set query=wmi.ExecQuery("Select * from Win32_VideoController") i=0 For each item in query WSH.echo "name=" & item.Name WSH.echo "Video Memory=" & FormatSize(Abs(item.AdapterRAM)) WSH.echo "Current refresh rate=" & amp; item.CurrentRefreshRate WSH.echo "Horizontal Resolution=" & amp; item.CurrentHorizontalResolution WSH.echo "Vertical Resolution=" & amp; item.CurrentVerticalResolution if i>0 Then File.Write " || " End If File.Write item.Name & amp; "/" & amp; FormatSize(Abs(item.AdapterRAM)) & amp; "/" & amp; item.CurrentRefreshRate & amp; "Hz/" & amp; item.CurrentHorizontalResolution & amp; "/" & amp; item.CurrentVerticalResolution i=1 Next File.Write "," WSH.echo "--------------sound card-------------" Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice") i=0 For each item in query WSH.echo item.Name if i>0 Then File.Write " || " End If File.Write item.Name i=1 Next File.Write "," WSH.echo "---------------Camera-------------" Set query=wmi.ExecQuery("Select * from Win32_PnPEntity where Service='usbvideo'") i=0 For each item in query WSH.echo "serial number=" & amp; item.DeviceID WSH.echo "name=" & item.Name WSH.echo "Manufacturer=" & item.Manufacturer WSH.echo "status=" & item.Status if i>0 Then File.Write " || " End If File.Write item.DeviceID & amp; "/" & amp; item.Name & amp; "/" & amp; item.Manufacturer & amp; "/" & amp; item.Status i=1 Next File.Write "," WSH.echo "--------------Printer-------------" Set query=wmi.ExecQuery("Select * from Win32_Printer") i=0 For each item in query If item.Default =True Then WSH.echo item.Name & "(Default)" Else WSH.echo item.Name End If if i>0 Then File.Write " || " End If If item.Default =True Then File.Write item.Name & "(Default)" Else File.Write item.Name End If i=1 Next File.Write vbNewLine 'New line at the end of the line, alternate for different platforms: File.Write vbCrLf Function FormatSize(byVal t) If t >= 1099511627776 Then FormatSize = FormatNumber(t/1099511627776, 2, true) & amp; "TB" ElseIf t >= 1073741824 Then FormatSize = FormatNumber(t/1073741824, 0, true) & amp; "GB" ElseIf t >= 1048576 Then FormatSize = FormatNumber(t/1048576, 0, true) & amp; "MB" ElseIf t >= 1024 Then FormatSize = FormatNumber(t/1024, 0, true) & amp; "KB" Else FormatSize = t & "B" End If End Function File.Close 'Close the file