[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] 付费求助一个获取本机电脑配置的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(没有则不显示)

回复 1# zdv478
简单写写,前半截:
  1. ' 2>nul 3>nul&cls&@echo off
  2. '&rem 获取本机系统及硬件配置信息
  3. '&cd /d "%~dp0"
  4. '&cscript -nologo -e:vbscript "%~fs0">info.txt
  5. '&pause&exit
  6.    
  7. On Error Resume Next
  8. Set fso=CreateObject("Scripting.Filesystemobject")
  9. Set ws=CreateObject("WScript.Shell")
  10. Set wmi=GetObject("winmgmts:\\.\root\cimv2")
  11. WSH.echo "---------------我的电脑-------------"  
  12. Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
  13. For each item in query
  14.     WSH.echo "电脑名称:" & item.Name
  15. Next
  16. Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
  17. For each item in query
  18.     WSH.echo "电脑系统:" & item.Caption & "[" & item.Version & "]"
  19. WSH.echo "安装日期:" & UTCtoNow(item.InstallDate)
  20.     visiblemem=item.TotalVisibleMemorySize
  21.     virtualmem=item.TotalVirtualMemorySize
  22. Next
  23. Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  24. Set colLoggedEvents = WMI.ExecQuery("Select * from Win32_NTLogEvent Where Logfile = 'System' And EventCode = '6005' Or EventCode = '6006'")
  25. For Each objEvent In colLoggedEvents
  26.     Flag = Flag +1
  27.     If Flag = 1 Then
  28.         startTime=UTCtoNow(objEvent.TimeWritten)
  29.     End If
  30. Next
  31. CurrentDate = year(Now) &"-"& Month(Now) &"-"& day(Now)
  32. CurrentTime = Hour(Now) &":"& Minute(Now) &":"& Second(Now)
  33. currentTime = CurrentDate &" "& CurrentTime
  34. difMinute = datediff("s",startTime,currentTime ) / 60 / 60
  35. difM = round(difMinute,2)
  36. m=Round(split(difM,".")(1)*60/100,0)
  37. h=split(difM,".")(0)
  38. Wscript.Echo "运行时长:" & h &" 小时 "& m &" 分钟"
  39. Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
  40. For each item in query
  41.     Set query2=wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where Index=" & item.Index)
  42.     For each item2 in query2
  43.         If typeName(item2.IPAddress) <> "Null" Then
  44.             WSH.echo "本机IP:" & item2.IPAddress(0)
  45. If typeName(item2.DNSServerSearchOrder) <> "Null" Then
  46. WSH.echo "DNS1:" & item2.DNSServerSearchOrder(0)
  47. WSH.echo "DNS2:" & item2.DNSServerSearchOrder(1)
  48. End  If
  49.         End If
  50.     Next
  51. Next
  52. WSH.echo
  53. WSH.echo "---------------硬件信息-------------"
  54.    
  55.    
  56. Function FormatSize(byVal t)
  57.     If t >= 1099511627776 Then
  58.         FormatSize = FormatNumber(t/1099511627776, 2, true) & " TB"
  59.     ElseIf t >= 1073741824 Then
  60.         FormatSize = FormatNumber(t/1073741824, 2, true) & " GB"
  61.     ElseIf t >= 1048576 Then
  62.         FormatSize = FormatNumber(t/1048576, 2, true) & " MB"
  63.     ElseIf t >= 1024 Then
  64.         FormatSize = FormatNumber(t/1024, 2, true) & " KB"
  65.     Else
  66.         FormatSize = t & " B"   
  67.     End If
  68. End Function
  69. Function UTCtoNow(nD)
  70.     If Not IsNull(nD) Then
  71.     Set SWDT = CreateObject("WbemScripting.SWbemDateTime")
  72.     SWDT.Value = nD
  73.     UTCtoNow = SWDT.GetVarDate(True)
  74.     End If
  75. End Function
复制代码

TOP

TOP

回复 3# newswan


    我去,获取到的信息好详细啊,感谢

TOP

我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 2# holley
你好,下半截可以写吗?可以的话 我加你下 私聊

TOP

回复 5# Batcher


   谢谢大佬提供,这些我都看了下有的不是太准确,主要是想实现汉字形式展现型号

TOP

回复 3# newswan


    这个在我电脑上显示第一行字就不动了,不知道为什么。

TOP

回复 8# zdv478
只有自己去分析,我电脑上试了,也不行,win10 ltsc

TOP

回复 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=超微



这东西全靠搜集

QQ 20147578

TOP

返回列表