该脚本非原创,从其它博客复制过来,在其基础上更改了几行代码
复制到txt,更改后缀为bat,双击即可使用
================================================================
/*&cls&echo off&cd /d "%~dp0"
rem 功能: 获取本机系统及硬件配置信息
rem 日期:2022.09.14
rem 原代码网址:https://www.cnblogs.com/zhaolongisme/p/16628155.html
set #=获取本机系统及硬件配置信息
title %#%
set /p "b=请输入你所在的部门:"
set /p "m=请输入你名字:"
echo ..
echo ..
set y=%date:~0,4%%date:~5,2%%date:~8,2%
type "%~f0"|cscript -nologo -e:jscript "%~f0">"%tmp%\v.v"
cscript -nologo -e:vbscript "%tmp%\v.v" 2>%b%_%m%_%USERDOMAIN%_%y%_info.txt
echo ..
echo ..
echo /-----------------------------------------------\
echo 请查看当前目录下的 %b%_%m%_%USERDOMAIN%_%y%.txt
echo \-----------------------------------------------/
echo ..
echo ..
pause
rem start %b%_%m%_%USERDOMAIN%_%y%.txt
exit
*/
var text=WSH.StdIn.ReadAll();
var vbs=text.match(/\/\*\r\n([\s\S]+)\*\/\s*$/);
WSH.echo(vbs[1]);
/*
On Error Resume Next
Set fso=CreateObject("Scripting.Filesystemobject")
Set ws=CreateObject("WScript.Shell")
Set wmi=GetObject("winmgmts:\\.\root\cimv2")
WSH.echo " 系统信息收集中, 请稍等..."
WSH.echo "============================="
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============系统信息============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
For each item in query
WSH.StdErr.WriteLine "当前用户 = "& item.UserName
WSH.StdErr.WriteLine "工作组 = " & item.Workgroup
WSH.StdErr.WriteLine "域名 = " & item.Domain
WSH.StdErr.WriteLine "计算机名 = " & item.Name
WSH.StdErr.WriteLine "系统类型 = " & item.SystemType
Next
Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
For each item in query
WSH.StdErr.WriteLine "系统 = " & item.Caption & "[" & item.Version & "]"
WSH.StdErr.WriteLine "初始安装日期 = " & item.InstallDate
visiblemem=item.TotalVisibleMemorySize
virtualmem=item.TotalVirtualMemorySize
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============主板BIOS============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
For each item in query
WSH.StdErr.WriteLine "制造商 = " & item.Vendor
WSH.StdErr.WriteLine "型号 = " & item.Name
Next
Set query=wmi.ExecQuery("Select * from Win32_BIOS")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "bios制造商 = " & item.Manufacturer
WSH.StdErr.WriteLine "发布日期 = " & item.ReleaseDate
WSH.StdErr.WriteLine "版本 = " & item.SMBIOSBIOSVersion
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============CPU信息============"
Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR")
For each item in query
WSH.StdErr.WriteLine "序号 = " & item.DeviceID
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "架构 = " & item.Description
WSH.StdErr.WriteLine "核心 = " & item.NumberOfCores
WSH.StdErr.WriteLine "线程 = " & item.NumberOfLogicalProcessors
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============内存============"
WSH.StdErr.WriteLine "总物理内存 = " & FormatNumber(visiblemem/1048576,2,True) & " GB"
WSH.StdErr.WriteLine "总虚拟内存 = " & FormatNumber(virtualmem/1048576,2,True) & " GB"
WSH.StdErr.WriteLine '\n'
Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory")
For each item in query
WSH.StdErr.WriteLine "序号 = " & item.Tag
WSH.StdErr.WriteLine "容量 = " & FormatSize(item.Capacity)
WSH.StdErr.WriteLine "主频 = " & item.Speed & " MHz"
WSH.StdErr.WriteLine "制造商 = " & item.Manufacturer
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============物理硬盘============"
Set query=wmi.ExecQuery("Select * from Win32_DiskDrive")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Caption
WSH.StdErr.WriteLine "接口 = " & item.InterfaceType
WSH.StdErr.WriteLine "容量 = " & FormatSize(item.Size)
WSH.StdErr.WriteLine "分区数 = " & item.Partitions
WSH.StdErr.WriteLine String(20, "-")
Set query2=wmi.ExecQuery("Select * from Win32_LogicalDiskToPartition")
For Each item2 In query2
If InStr(item2.Antecedent, "Disk #" & q1.Index & ",") Then
drive=split(item2.Dependent, """")(1)
Set query3=wmi.ExecQuery("Select * from Win32_LogicalDisk Where Caption='" & drive & "'")
For each item3 in query3
WSH.StdErr.WriteLine item3.Caption & Chr(9) & item3.FileSystem & Chr(9) & "总容量:" & FormatSize(item3.Size) & Chr(9) & "可用容量:" &FormatSize(item3.FreeSpace)
Next
End If
Next
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============网卡============"
Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "连接名 = " & item.NetConnectionID
WSH.StdErr.WriteLine "MAC = " & item.MACAddress
Set query2=wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where Index=" & item.Index)
For each item2 in query2
If typeName(item2.IPAddress) <> "Null" Then
WSH.StdErr.WriteLine "IP = " & item2.IPAddress(0)
End If
Next
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============屏幕============"
Set query=wmi.ExecQuery("Select * from Win32_DesktopMonitor")
For Each item In query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "信息 = " & item.PNPDeviceID
WSH.StdErr.WriteLine "宽度 = " & item.ScreenWidth
WSH.StdErr.WriteLine "高度 = " & item.ScreenHeight
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============显卡============"
Set query=wmi.ExecQuery("Select * from Win32_VideoController")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "显存 = " & FormatSize(Abs(item.AdapterRAM))
WSH.StdErr.WriteLine "当前刷新率 = " & item.CurrentRefreshRate & "Hz"
WSH.StdErr.WriteLine "水平分辨率 = " & item.CurrentHorizontalResolution
WSH.StdErr.WriteLine "垂直分辨率 = " & item.CurrentVerticalResolution
WSH.StdErr.WriteLine "驱动版本 = " & item.DriverVersion
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============声卡============"
Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice")
For each item in query
WSH.StdErr.WriteLine item.Name
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============打印机============"
Set query=wmi.ExecQuery("Select * from Win32_Printer")
For each item in query
If item.Default =True Then
WSH.StdErr.WriteLine item.Name & "(默认)"
Else
WSH.StdErr.WriteLine item.Name
End If
Next
WSH.echo " 电脑信息已经收集完成!"
WSH.echo "============================"
WSH.Quit
Function FormatSize(byVal t)
If t >= 1099511627776 Then
FormatSize = FormatNumber(t/1099511627776, 2, true) & " TB"
ElseIf t >= 1073741824 Then
FormatSize = FormatNumber(t/1073741824, 2, true) & " GB"
ElseIf t >= 1048576 Then
FormatSize = FormatNumber(t/1048576, 2, true) & " MB"
ElseIf t >= 1024 Then
FormatSize = FormatNumber(t/1024, 2, true) & " KB"
Else
FormatSize = t & " B"
End If
End Function
*/
================================================================
复制到txt,更改后缀为bat,双击即可使用
================================================================
/*&cls&echo off&cd /d "%~dp0"
rem 功能: 获取本机系统及硬件配置信息
rem 日期:2022.09.14
rem 原代码网址:https://www.cnblogs.com/zhaolongisme/p/16628155.html
set #=获取本机系统及硬件配置信息
title %#%
set /p "b=请输入你所在的部门:"
set /p "m=请输入你名字:"
echo ..
echo ..
set y=%date:~0,4%%date:~5,2%%date:~8,2%
type "%~f0"|cscript -nologo -e:jscript "%~f0">"%tmp%\v.v"
cscript -nologo -e:vbscript "%tmp%\v.v" 2>%b%_%m%_%USERDOMAIN%_%y%_info.txt
echo ..
echo ..
echo /-----------------------------------------------\
echo 请查看当前目录下的 %b%_%m%_%USERDOMAIN%_%y%.txt
echo \-----------------------------------------------/
echo ..
echo ..
pause
rem start %b%_%m%_%USERDOMAIN%_%y%.txt
exit
*/
var text=WSH.StdIn.ReadAll();
var vbs=text.match(/\/\*\r\n([\s\S]+)\*\/\s*$/);
WSH.echo(vbs[1]);
/*
On Error Resume Next
Set fso=CreateObject("Scripting.Filesystemobject")
Set ws=CreateObject("WScript.Shell")
Set wmi=GetObject("winmgmts:\\.\root\cimv2")
WSH.echo " 系统信息收集中, 请稍等..."
WSH.echo "============================="
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============系统信息============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
For each item in query
WSH.StdErr.WriteLine "当前用户 = "& item.UserName
WSH.StdErr.WriteLine "工作组 = " & item.Workgroup
WSH.StdErr.WriteLine "域名 = " & item.Domain
WSH.StdErr.WriteLine "计算机名 = " & item.Name
WSH.StdErr.WriteLine "系统类型 = " & item.SystemType
Next
Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
For each item in query
WSH.StdErr.WriteLine "系统 = " & item.Caption & "[" & item.Version & "]"
WSH.StdErr.WriteLine "初始安装日期 = " & item.InstallDate
visiblemem=item.TotalVisibleMemorySize
virtualmem=item.TotalVirtualMemorySize
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============主板BIOS============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
For each item in query
WSH.StdErr.WriteLine "制造商 = " & item.Vendor
WSH.StdErr.WriteLine "型号 = " & item.Name
Next
Set query=wmi.ExecQuery("Select * from Win32_BIOS")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "bios制造商 = " & item.Manufacturer
WSH.StdErr.WriteLine "发布日期 = " & item.ReleaseDate
WSH.StdErr.WriteLine "版本 = " & item.SMBIOSBIOSVersion
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============CPU信息============"
Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR")
For each item in query
WSH.StdErr.WriteLine "序号 = " & item.DeviceID
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "架构 = " & item.Description
WSH.StdErr.WriteLine "核心 = " & item.NumberOfCores
WSH.StdErr.WriteLine "线程 = " & item.NumberOfLogicalProcessors
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============内存============"
WSH.StdErr.WriteLine "总物理内存 = " & FormatNumber(visiblemem/1048576,2,True) & " GB"
WSH.StdErr.WriteLine "总虚拟内存 = " & FormatNumber(virtualmem/1048576,2,True) & " GB"
WSH.StdErr.WriteLine '\n'
Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory")
For each item in query
WSH.StdErr.WriteLine "序号 = " & item.Tag
WSH.StdErr.WriteLine "容量 = " & FormatSize(item.Capacity)
WSH.StdErr.WriteLine "主频 = " & item.Speed & " MHz"
WSH.StdErr.WriteLine "制造商 = " & item.Manufacturer
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============物理硬盘============"
Set query=wmi.ExecQuery("Select * from Win32_DiskDrive")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Caption
WSH.StdErr.WriteLine "接口 = " & item.InterfaceType
WSH.StdErr.WriteLine "容量 = " & FormatSize(item.Size)
WSH.StdErr.WriteLine "分区数 = " & item.Partitions
WSH.StdErr.WriteLine String(20, "-")
Set query2=wmi.ExecQuery("Select * from Win32_LogicalDiskToPartition")
For Each item2 In query2
If InStr(item2.Antecedent, "Disk #" & q1.Index & ",") Then
drive=split(item2.Dependent, """")(1)
Set query3=wmi.ExecQuery("Select * from Win32_LogicalDisk Where Caption='" & drive & "'")
For each item3 in query3
WSH.StdErr.WriteLine item3.Caption & Chr(9) & item3.FileSystem & Chr(9) & "总容量:" & FormatSize(item3.Size) & Chr(9) & "可用容量:" &FormatSize(item3.FreeSpace)
Next
End If
Next
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============网卡============"
Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "连接名 = " & item.NetConnectionID
WSH.StdErr.WriteLine "MAC = " & item.MACAddress
Set query2=wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where Index=" & item.Index)
For each item2 in query2
If typeName(item2.IPAddress) <> "Null" Then
WSH.StdErr.WriteLine "IP = " & item2.IPAddress(0)
End If
Next
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============屏幕============"
Set query=wmi.ExecQuery("Select * from Win32_DesktopMonitor")
For Each item In query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "信息 = " & item.PNPDeviceID
WSH.StdErr.WriteLine "宽度 = " & item.ScreenWidth
WSH.StdErr.WriteLine "高度 = " & item.ScreenHeight
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============显卡============"
Set query=wmi.ExecQuery("Select * from Win32_VideoController")
For each item in query
WSH.StdErr.WriteLine "名称 = " & item.Name
WSH.StdErr.WriteLine "显存 = " & FormatSize(Abs(item.AdapterRAM))
WSH.StdErr.WriteLine "当前刷新率 = " & item.CurrentRefreshRate & "Hz"
WSH.StdErr.WriteLine "水平分辨率 = " & item.CurrentHorizontalResolution
WSH.StdErr.WriteLine "垂直分辨率 = " & item.CurrentVerticalResolution
WSH.StdErr.WriteLine "驱动版本 = " & item.DriverVersion
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============声卡============"
Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice")
For each item in query
WSH.StdErr.WriteLine item.Name
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============打印机============"
Set query=wmi.ExecQuery("Select * from Win32_Printer")
For each item in query
If item.Default =True Then
WSH.StdErr.WriteLine item.Name & "(默认)"
Else
WSH.StdErr.WriteLine item.Name
End If
Next
WSH.echo " 电脑信息已经收集完成!"
WSH.echo "============================"
WSH.Quit
Function FormatSize(byVal t)
If t >= 1099511627776 Then
FormatSize = FormatNumber(t/1099511627776, 2, true) & " TB"
ElseIf t >= 1073741824 Then
FormatSize = FormatNumber(t/1073741824, 2, true) & " GB"
ElseIf t >= 1048576 Then
FormatSize = FormatNumber(t/1048576, 2, true) & " MB"
ElseIf t >= 1024 Then
FormatSize = FormatNumber(t/1024, 2, true) & " KB"
Else
FormatSize = t & " B"
End If
End Function
*/
================================================================