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

[系统相关] 想把批处理命令导出至桌面重命名为systeminfo.txt

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

第7行改为
  1. '&cscript -nologo -e:vbscript "%~fs0">"%USERPROFILE%\desktop\systeminfo.txt"
复制代码

TOP

返回列表