当前位置:   article > 正文

windows批处理自动获取电脑配置信息_批处理获取系统信息

批处理获取系统信息
  1. ' 2>nul 3>nul&cls&@echo off
  2. '&rem 获取本机系统及硬件配置信息
  3. '&set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
  4. '&title %#% +%$%%$%/%@% %z%
  5. '&cd /d "%~dp0"
  6. '&set "outfile=xxx.txt"
  7. '&cscript -nologo -e:vbscript "%~fs0"
  8. '&echo;%#% +%$%%$%/%@% %z%
  9. '&pause&exit
  10. On Error Resume Next
  11. Set fso=CreateObject("Scripting.Filesystemobject")
  12. Set ws=CreateObject("WScript.Shell")
  13. Set wmi=GetObject("winmgmts:\\.\root\cimv2")
  14. WSH.echo "---------------系统-------------"
  15. Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
  16. For each item in query
  17. WSH.echo "当前用户=" & item.UserName
  18. WSH.echo "工作组=" & item.Workgroup
  19. WSH.echo "域=" & item.Domain
  20. WSH.echo "计算机名=" & item.Name
  21. WSH.echo "系统类型=" & item.SystemType
  22. Next
  23. Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
  24. For each item in query
  25. WSH.echo "系统=" & item.Caption & "[" & item.Version & "]"
  26. WSH.echo "初始安装日期=" & item.InstallDate
  27. visiblemem=item.TotalVisibleMemorySize
  28. virtualmem=item.TotalVirtualMemorySize
  29. Next
  30. Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
  31. For each item in query
  32. WSH.echo "制造商=" & item.Vendor
  33. WSH.echo "型号=" & item.Name
  34. Next
  35. WSH.echo "---------------主板BIOS-------------"
  36. Set query=wmi.ExecQuery("Select * from Win32_BaseBoard")
  37. For each item in query
  38. WSH.echo "制造商=" & item.Manufacturer
  39. WSH.echo "序列号=" & item.SerialNumber
  40. Next
  41. Set query=wmi.ExecQuery("Select * from Win32_BIOS")
  42. For each item in query
  43. WSH.echo "名称=" & item.Name
  44. WSH.echo "bios制造商=" & item.Manufacturer
  45. WSH.echo "发布日期=" & item.ReleaseDate
  46. WSH.echo "版本=" & item.SMBIOSBIOSVersion
  47. Next
  48. WSH.echo "---------------CPU-------------"
  49. Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR")
  50. For each item in query
  51. WSH.echo "序号=" & item.DeviceID
  52. WSH.echo "名称=" & item.Name
  53. WSH.echo "核心=" & item.NumberOfCores
  54. WSH.echo "线程=" & item.NumberOfLogicalProcessors
  55. Next
  56. WSH.echo "---------------内存-------------"
  57. WSH.echo "总物理内存=" & FormatNumber(visiblemem/1048576,2,True) & " GB"
  58. WSH.echo "总虚拟内存=" & FormatNumber(virtualmem/1048576,2,True) & " GB"
  59. Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory")
  60. For each item in query
  61. WSH.echo "序号=" & item.Tag
  62. WSH.echo "容量=" & FormatSize(item.Capacity)
  63. WSH.echo "主频=" & item.Speed
  64. WSH.echo "制造商=" & item.Manufacturer
  65. Next
  66. WSH.echo "--------------硬盘-------------"
  67. Set query=wmi.ExecQuery("Select * from Win32_DiskDrive")
  68. For each item in query
  69. WSH.echo "名称=" & item.Caption
  70. WSH.echo "接口=" & item.InterfaceType
  71. WSH.echo "容量=" & FormatSize(item.Size)
  72. WSH.echo "分区数=" & item.Partitions
  73. Next
  74. Set query=wmi.ExecQuery("Select * from Win32_LogicalDisk Where DriveType=3 or DriveType=2")
  75. For each item in query
  76. WSH.echo item.Caption & Chr(9) & item.FileSystem & Chr(9) & FormatSize(item.Size) & Chr(9) & FormatSize(item.FreeSpace)
  77. Next
  78. WSH.echo "--------------网卡-------------"
  79. Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
  80. For each item in query
  81. WSH.echo "名称=" & item.Name
  82. WSH.echo "连接名=" & item.NetConnectionID
  83. WSH.echo "MAC=" & item.MACAddress
  84. Set query2=wmi.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where Index=" & item.Index)
  85. For each item2 in query2
  86. If typeName(item2.IPAddress) <> "Null" Then
  87. WSH.echo "IP=" & item2.IPAddress(0)
  88. End If
  89. Next
  90. Next
  91. WSH.echo "--------------显示-------------"
  92. Set query=wmi.ExecQuery("Select * from Win32_VideoController")
  93. For each item in query
  94. WSH.echo "名称=" & item.Name
  95. WSH.echo "显存=" & FormatSize(Abs(item.AdapterRAM))
  96. WSH.echo "当前刷新率=" & item.CurrentRefreshRate
  97. WSH.echo "水平分辨率=" & item.CurrentHorizontalResolution
  98. WSH.echo "垂直分辨率=" & item.CurrentVerticalResolution
  99. Next
  100. WSH.echo "--------------声卡-------------"
  101. Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice")
  102. For each item in query
  103. WSH.echo item.Name
  104. Next
  105. WSH.echo "--------------打印机-------------"
  106. Set query=wmi.ExecQuery("Select * from Win32_Printer")
  107. For each item in query
  108. If item.Default =True Then
  109. WSH.echo item.Name & "(默认)"
  110. Else
  111. WSH.echo item.Name
  112. End If
  113. Next
  114. Function FormatSize(byVal t)
  115. If t >= 1099511627776 Then
  116. FormatSize = FormatNumber(t/1099511627776, 2, true) & " TB"
  117. ElseIf t >= 1073741824 Then
  118. FormatSize = FormatNumber(t/1073741824, 2, true) & " GB"
  119. ElseIf t >= 1048576 Then
  120. FormatSize = FormatNumber(t/1048576, 2, true) & " MB"
  121. ElseIf t >= 1024 Then
  122. FormatSize = FormatNumber(t/1024, 2, true) & " KB"
  123. Else
  124. FormatSize = t & " B"
  125. End If
  126. End Function

复制粘贴到记事本,另存为xx.bat,编码选ANSI

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/程序诗人/article/detail/61761
推荐阅读
相关标签
  

闽ICP备14008679号