标题: [文件操作] 付费求助一个获取本机电脑配置的BAT [打印本页]
作者: zdv478 时间: 2023-3-16 22:48 标题: 付费求助一个获取本机电脑配置的BAT
需要获取以下信息及内容,主要显示CPU 主板 内存 显卡以汉字形式显示品牌型号,获取后在桌面新建一个txt保存!可以写的大佬麻烦联系我一下!
-------------我的电脑-------------
电脑系统:Microsoft Windows 10 专业版 (64位)
电脑名称:PC-01
安装日期:2023-03-15 14:13:27
运行时长:14小时26分3秒
本机IP:192.168.0.166
DNS:设置则显示,不设置不显示
-------------硬件信息-------------
主板:微星B360MPRO-vDMS-7B53)
CPU:英特尔酷睿 i7-8700 CPU @ 3.20GHz x 6核
内存:金泰克32GB DDR4双通道
显卡:NVIDIA (英伟达)Quadro P2000 (GP106GL) [DELL]
硬盘1(系统盘):Fanxiang S505/2TB( 2TB,固态硬盘 )
硬盘2:Fanxiang S505/2TB( 1TB,固态硬盘 )
显示器1:飞利浦 PHL 237E7
显示器2:三星 237E7(没有则不显示)
作者: holley 时间: 2023-3-17 18:14
回复 1# zdv478
简单写写,前半截:- ' 2>nul 3>nul&cls&@echo off
- '&rem 获取本机系统及硬件配置信息
- '&cd /d "%~dp0"
- '&cscript -nologo -e:vbscript "%~fs0">info.txt
- '&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.Name
- Next
-
- Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
- For each item in query
- WSH.echo "电脑系统:" & item.Caption & "[" & item.Version & "]"
- WSH.echo "安装日期:" & UTCtoNow(item.InstallDate)
- visiblemem=item.TotalVisibleMemorySize
- virtualmem=item.TotalVirtualMemorySize
- Next
-
- Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
- Set colLoggedEvents = WMI.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' And EventCode = '6005' Or EventCode = '6006'")
- For Each objEvent In colLoggedEvents
- Flag = Flag +1
- If Flag = 1 Then
- startTime=UTCtoNow(objEvent.TimeWritten)
- End If
- Next
-
- CurrentDate = year(Now) &"-"& Month(Now) &"-"& day(Now)
- CurrentTime = Hour(Now) &":"& Minute(Now) &":"& Second(Now)
-
- currentTime = CurrentDate &" "& CurrentTime
-
- difMinute = datediff("s",startTime,currentTime ) / 60 / 60
- difM = round(difMinute,2)
- m=Round(split(difM,".")(1)*60/100,0)
- h=split(difM,".")(0)
-
- Wscript.Echo "运行时长:" & h &" 小时 "& m &" 分钟"
-
- Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
- For each item in query
- 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)
- If typeName(item2.DNSServerSearchOrder) <> "Null" Then
- WSH.echo "DNS1:" & item2.DNSServerSearchOrder(0)
- WSH.echo "DNS2:" & item2.DNSServerSearchOrder(1)
- End If
- End If
- Next
- Next
-
- WSH.echo
- WSH.echo "---------------硬件信息-------------"
-
-
- 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
-
- Function UTCtoNow(nD)
- If Not IsNull(nD) Then
- Set SWDT = CreateObject("WbemScripting.SWbemDateTime")
- SWDT.Value = nD
- UTCtoNow = SWDT.GetVarDate(True)
- End If
- End Function
复制代码
作者: newswan 时间: 2023-3-17 20:42
https://pan.baidu.com/s/1DxsqTKruZJsAH44_hiaTBg?pwd=svrr
以前的,试试
作者: 咔咔乱坠 时间: 2023-3-17 22:54
回复 3# newswan
我去,获取到的信息好详细啊,感谢
作者: Batcher 时间: 2023-3-18 09:25
批处理获取硬件信息
http://bbs.bathome.net/thread-1850-1-1.html
http://bbs.bathome.net/thread-17703-1-1.html
http://bbs.bathome.net/thread-38259-1-1.html
VBS获取硬件信息
http://bbs.bathome.net/thread-13048-1-1.html
PowerShell获取硬件信息
http://bbs.bathome.net/thread-14205-1-1.html
作者: zdv478 时间: 2023-3-18 11:46
回复 2# holley
你好,下半截可以写吗?可以的话 我加你下 私聊
作者: zdv478 时间: 2023-3-18 11:47
回复 5# Batcher
谢谢大佬提供,这些我都看了下有的不是太准确,主要是想实现汉字形式展现型号
作者: zdv478 时间: 2023-3-18 11:48
回复 3# newswan
这个在我电脑上显示第一行字就不动了,不知道为什么。
作者: newswan 时间: 2023-3-20 17:57
回复 8# zdv478
只有自己去分析,我电脑上试了,也不行,win10 ltsc
作者: czjt1234 时间: 2023-3-20 20:44
回复 7# zdv478
那个下载的批处理,里面有
if /i "%Manufacturer:~0,2%" == "HP" set Manufacturer=惠普
if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星
if /i "%Manufacturer:~0,4%" == "ACER" set Manufacturer=宏碁
if /i "%Manufacturer:~0,4%" == "DELL" set Manufacturer=戴尔
if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=华硕
if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米
if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷
if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂达
if /i "%Manufacturer:~0,5%" == "HASEE" set Manufacturer=神州
if /i "%Manufacturer:~0,5%" == "HAIER" set Manufacturer=海尔
if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正
if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升
if /i "%Manufacturer:~0,5%" == "APPLE" set Manufacturer=苹果
if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特尔
if /i "%Manufacturer:~0,6%" == "HUAWEI" set Manufacturer=华为
if /i "%Manufacturer:~0,6%" == "YESTON" set Manufacturer=盈通
if /i "%Manufacturer:~0,6%" == "LIYANG" set Manufacturer=力阳
if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=铭瑄
if /i "%Manufacturer:~0,6%" == "LENOVO" set Manufacturer=联想
if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=华擎
if /i "%Manufacturer:~0,6%" == "HUANAN" set Manufacturer=华南
if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影驰
if /i "%Manufacturer:~0,7%" == "SAMSUNG" set Manufacturer=三星
if /i "%Manufacturer:~0,7%" == "HEWLETT" set Manufacturer=惠普
if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=东芝
if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰
if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉
if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹
if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=蓝宝石
if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=机械**
if /i "%Manufacturer:~0,9%" == "ALIENWARE" set Manufacturer=外星人
if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微
这东西全靠搜集
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |