写一个bat文件自动获取电脑配置信息
@echooffecho登录名:%USERNAME%echo计算机名:%COMPUTERNAME%for/f"tokens=2delims=="%%ain('wmiccp...
@echo off
echo 登录名:%USERNAME%
echo 计算机名:%COMPUTERNAME%
for /f "tokens=2 delims==" %%a in ('wmic cpu get Name /value ^| findstr /i "Name"') do echo 处理器:%%~a
for /f "tokens=2 delims==" %%a in ('wmic memorychip get Capacity /value ^| findstr /i "Capacity"') do echo 内存容量:%%~a
for /f "tokens=2 delims==" %%a in ('wmic DiskDrive get Size /value ^| findstr /i "Size"') do echo 硬盘容量:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get IdentifyingNumber /value ^| findstr /i "IdentifyingNumber"') do echo SN序列号:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get Name /value ^| findstr /i "Name"') do echo 电脑型号:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo 制造商:%%~a
pause
我想添加MAC地址收集,内存和硬盘容量改为G显示,还有怎么可以自动保存的C盘的某个路径下面,谢谢 展开
echo 登录名:%USERNAME%
echo 计算机名:%COMPUTERNAME%
for /f "tokens=2 delims==" %%a in ('wmic cpu get Name /value ^| findstr /i "Name"') do echo 处理器:%%~a
for /f "tokens=2 delims==" %%a in ('wmic memorychip get Capacity /value ^| findstr /i "Capacity"') do echo 内存容量:%%~a
for /f "tokens=2 delims==" %%a in ('wmic DiskDrive get Size /value ^| findstr /i "Size"') do echo 硬盘容量:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get IdentifyingNumber /value ^| findstr /i "IdentifyingNumber"') do echo SN序列号:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get Name /value ^| findstr /i "Name"') do echo 电脑型号:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo 制造商:%%~a
pause
我想添加MAC地址收集,内存和硬盘容量改为G显示,还有怎么可以自动保存的C盘的某个路径下面,谢谢 展开
4个回答
展开全部
复制粘贴到记事本,另存为xx.bat,编码选ANSI
' 2>nul 3>nul&cls&@echo off
'&rem 获取本机系统及硬件配置信息
'&set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
'&title %#% +%$%%$%/%@% %z%
'&cd /d "%~dp0"
'&set "outfile=xxx.txt"
'&cscript -nologo -e:vbscript "%~fs0"
'&echo;%#% +%$%%$%/%@% %z%
'&pause&exit
On Error Resume Next
Set fso=CreateObject("Scripting.Filesystemobject")
Set ws=CreateObject("WScript.Shell")
Set wmi=GetObject("winmgmts:\\.\root\cimv2")
WSH.echo "---------------系统-------------"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
For each item in query
WSH.echo "当前用户=" & item.UserName
WSH.echo "工作组=" & item.Workgroup
WSH.echo "域=" & item.Domain
WSH.echo "计算机名=" & item.Name
WSH.echo "系统类型=" & item.SystemType
Next
Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
For each item in query
WSH.echo "系统=" & item.Caption & "[" & item.Version & "]"
WSH.echo "初始安装日期=" & item.InstallDate
visiblemem=item.TotalVisibleMemorySize
virtualmem=item.TotalVirtualMemorySize
Next
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
For each item in query
WSH.echo "制造商=" & item.Vendor
WSH.echo "型号=" & item.Name
Next
WSH.echo "---------------主板BIOS-------------"
Set query=wmi.ExecQuery("Select * from Win32_BaseBoard")
For each item in query
WSH.echo "制造商=" & item.Manufacturer
WSH.echo "序列号=" & item.SerialNumber
Next
Set query=wmi.ExecQuery("Select * from Win32_BIOS")
For each item in query
WSH.echo "名称=" & item.Name
WSH.echo "bios制造商=" & item.Manufacturer
WSH.echo "发布日期=" & item.ReleaseDate
WSH.echo "版本=" & item.SMBIOSBIOSVersion
Next
WSH.echo "---------------CPU-------------"
Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR")
For each item in query
WSH.echo "序号=" & item.DeviceID
WSH.echo "名称=" & item.Name
WSH.echo "核心=" & item.NumberOfCores
WSH.echo "线程=" & item.NumberOfLogicalProcessors
Next
WSH.echo "---------------内存-------------"
WSH.echo "总物理内存=" & FormatNumber(visiblemem/1048576,2,True) & " GB"
WSH.echo "总虚拟内存=" & FormatNumber(virtualmem/1048576,2,True) & " GB"
Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory")
For each item in query
WSH.echo "序号=" & item.Tag
WSH.echo "容量=" & FormatSize(item.Capacity)
WSH.echo "主频=" & item.Speed
WSH.echo "制造商=" & item.Manufacturer
Next
WSH.echo "--------------硬盘-------------"
Set query=wmi.ExecQuery("Select * from Win32_DiskDrive")
For each item in query
WSH.echo "名称=" & item.Caption
WSH.echo "接口=" & item.InterfaceType
WSH.echo "容量=" & FormatSize(item.Size)
WSH.echo "分区数=" & item.Partitions
Next
Set query=wmi.ExecQuery("Select * from Win32_LogicalDisk Where DriveType=3 or DriveType=2")
For each item in query
WSH.echo item.Caption & Chr(9) & item.FileSystem & Chr(9) & FormatSize(item.Size) & Chr(9) & FormatSize(item.FreeSpace)
Next
WSH.echo "--------------网卡-------------"
Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
For each item in query
WSH.echo "名称=" & item.Name
WSH.echo "连接名=" & item.NetConnectionID
WSH.echo "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.echo "IP=" & item2.IPAddress(0)
End If
Next
Next
WSH.echo "--------------显示-------------"
Set query=wmi.ExecQuery("Select * from Win32_VideoController")
For each item in query
WSH.echo "名称=" & item.Name
WSH.echo "显存=" & FormatSize(Abs(item.AdapterRAM))
WSH.echo "当前刷新率=" & item.CurrentRefreshRate
WSH.echo "水平分辨率=" & item.CurrentHorizontalResolution
WSH.echo "垂直分辨率=" & item.CurrentVerticalResolution
Next
WSH.echo "--------------声卡-------------"
Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice")
For each item in query
WSH.echo item.Name
Next
WSH.echo "--------------打印机-------------"
Set query=wmi.ExecQuery("Select * from Win32_Printer")
For each item in query
If item.Default =True Then
WSH.echo item.Name & "(默认)"
Else
WSH.echo item.Name
End If
Next
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
展开全部
@echo off & title 获取本机简要配置信息 By 依梦琴瑶
::设置信息保存路径
set Log=C:\某个文件夹\本机简要配置信息.txt
echo WScript.Echo Wscript.Arguments(0) / (1024 * 1024 * 1024)>Calculation.vbs
echo 正在获取信息中 ...
(for /f "tokens=2 delims==" %%a in ('wmic csproduct get Name /value ^| findstr /i "Name"') do echo 电脑型号:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo 制 造 商:%%~a
for /f "tokens=2 delims==" %%a in ('wmic csproduct get IdentifyingNumber /value ^| findstr /i "IdentifyingNumber"') do echo SN序列号:%%~a
echo 登 录 名:%USERNAME%
echo 计算机名:%COMPUTERNAME%
for /f "tokens=2 delims==" %%a in ('wmic cpu get Name /value ^| findstr /i "Name"') do echo 处 理 器:%%~a
for /f "tokens=2 delims==" %%a in ('wmic memorychip get Capacity /value ^| findstr /i "Capacity"') do (
for /f "tokens=1 delims=." %%b in ('cscript /nologo Calculation.vbs "%%~a"') do set /a m+=%%~b
)
call echo 内存容量:%%m%% GB
for /f "tokens=2 delims==" %%a in ('wmic DiskDrive get Size /value ^| findstr /i "Size"') do (
for /f "tokens=1 delims=." %%b in ('cscript /nologo Calculation.vbs "%%~a"') do set /a d+=%%~b
)
call echo 硬盘容量:%%d%% GB
for /f "tokens=2 delims==" %%a in ('wmic nic where "netconnectionid!=NULL" get macaddress /value ^| findstr /i "MACAddress"') do echo MAC 地址:%%~a)>"%Log%"
del Calculation.vbs
echo 信息获取,并保存。
pause
来自:求助得到的回答
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
只会一个mac收集
获取有线网卡mac:for /f "tokens=5 delims= " %%a in ('getmac /v ^|find /i "PCIe"') do echo 以太网mac:%%~a
获取有线网卡mac:for /f "tokens=5 delims= " %%a in ('getmac /v ^|find /i "PCIe"') do echo 以太网mac:%%~a
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2018-02-06
展开全部
在运行里输入logoff再按回车即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询