用脚本(batch、Powershell等)获取电脑上的CPU、硬盘、声卡、网卡、无线网卡、芯片组名称,安装内存大小信息
时间: 2023-09-06 10:14:01 浏览: 138
获取CPU、硬盘、网卡信息
4星 · 用户满意度95%
你可以使用以下脚本来获取电脑上的 CPU、硬盘、声卡、网卡、无线网卡、芯片组名称以及安装内存大小的信息。这个脚本使用的是 PowerShell。
```powershell
# 获取 CPU 型号
$cpuModel = (Get-WmiObject Win32_Processor).Name
# 获取硬盘信息
$diskModel = Get-WmiObject Win32_DiskDrive | Select-Object Model
# 获取声卡信息
$soundCardModel = Get-WmiObject Win32_SoundDevice | Select-Object Name
# 获取网卡信息
$networkCardModel = Get-WmiObject Win32_NetworkAdapter | Where-Object { $_.PhysicalAdapter -eq $true } | Select-Object Name
# 获取无线网卡信息
$wirelessCardModel = Get-WmiObject Win32_NetworkAdapter | Where-Object { $_.AdapterType -like "Wireless*" } | Select-Object Name
# 获取芯片组名称
$chipsetName = (Get-WmiObject Win32_ComputerSystem).Manufacturer + " " + (Get-WmiObject Win32_ComputerSystem).Model
# 获取安装内存大小
$installedMemory = (Get-WmiObject Win32_PhysicalMemory | Measure-Object Capacity -Sum).Sum / 1GB
# 输出信息
Write-Host "CPU 型号: $cpuModel"
Write-Host "硬盘型号: $diskModel"
Write-Host "声卡型号: $soundCardModel"
Write-Host "网卡型号: $networkCardModel"
Write-Host "无线网卡型号: $wirelessCardModel"
Write-Host "芯片组名称: $chipsetName"
Write-Host "安装内存大小: $installedMemory GB"
```
将以上代码保存为一个后缀为 `.ps1` 的文件,然后在 PowerShell 中运行该脚本,即可获取电脑上的相关信息。
阅读全文