DOS批处理命令,自动获取本机系统及硬件配置信息
可以配合域策略自动下发执行, 批量收集域内电脑配置;
手动执行亦可; 如下保存成.bat批处理文件执行即可.
/*&cls&echo off&cd /d "%~dp0"
rem 功能: 获取本机系统及硬件配置信息
rem 日期:2022.08.10
rem 制作人:zl
set #=获取本机系统及硬件配置信息
set _=百川盈孚
set $=技术部
set z=Tel:59795659
(hostname)>>%temp%\temp.txt
set /p h=<%temp%\temp.txt
del /f /q %temp%\temp.txt
title %#% + %_%%$% + %z%
set y=%date:~0,4%%date:~5,2%%date:~8,2%
type "%~f0"|cscript -nologo -e:jscript "%~f0">"%tmp%\v.v"
cscript -nologo -e:vbscript "%tmp%\v.v" 2>%h%_%y%_info.log
echo .
echo ..
echo /-----------------------------------------------\
echo 请查看当前目录下的 %h%_%y%_info.log
echo \-----------------------------------------------/
echo ..
echo .
pause
rem start %h%_%y%_info.log
exit
*/
var text=WSH.StdIn.ReadAll();
var vbs=text.match(/\/\*\r\n([\s\S]+)\*\/\s*$/);
WSH.echo(vbs[1]);
/*
On Error Resume Next
Set fso=CreateObject("Scripting.Filesystemobject")
Set ws=CreateObject("WScript.Shell")
Set wmi=GetObject("winmgmts:\\.\root\cimv2")
WSH.echo " 系统信息收集中, 请稍等..."
WSH.echo "============================="
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============系统信息============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystem")
For each item in query
WSH.StdErr.WriteLine "当前用户="& item.UserName
WSH.StdErr.WriteLine "工作组=" & item.Workgroup
WSH.StdErr.WriteLine "域=" & item.Domain
WSH.StdErr.WriteLine "计算机名=" & item.Name
WSH.StdErr.WriteLine "系统类型=" & item.SystemType
Next
Set query=wmi.ExecQuery("Select * from Win32_OperatingSystem")
For each item in query
WSH.StdErr.WriteLine "系统=" & item.Caption & "[" & item.Version & "]"
WSH.StdErr.WriteLine "初始安装日期=" & item.InstallDate
visiblemem=item.TotalVisibleMemorySize
virtualmem=item.TotalVirtualMemorySize
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============主板BIOS============"
Set query=wmi.ExecQuery("Select * from Win32_ComputerSystemProduct")
For each item in query
WSH.StdErr.WriteLine "制造商=" & item.Vendor
WSH.StdErr.WriteLine "型号=" & item.Name
Next
Set query=wmi.ExecQuery("Select * from Win32_BIOS")
For each item in query
WSH.StdErr.WriteLine "名称=" & item.Name
WSH.StdErr.WriteLine "bios制造商=" & item.Manufacturer
WSH.StdErr.WriteLine "发布日期=" & item.ReleaseDate
WSH.StdErr.WriteLine "版本=" & item.SMBIOSBIOSVersion
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============CPU信息============"
Set query=wmi.ExecQuery("Select * from WIN32_PROCESSOR")
For each item in query
WSH.StdErr.WriteLine "序号=" & item.DeviceID
WSH.StdErr.WriteLine "名称=" & item.Name
WSH.StdErr.WriteLine "核心=" & item.NumberOfCores
WSH.StdErr.WriteLine "线程=" & item.NumberOfLogicalProcessors
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============内存============"
WSH.StdErr.WriteLine "总物理内存=" & FormatNumber(visiblemem/1048576,2,True) & " GB"
WSH.StdErr.WriteLine "总虚拟内存=" & FormatNumber(virtualmem/1048576,2,True) & " GB"
Set query=wmi.ExecQuery("Select * from Win32_PhysicalMemory")
For each item in query
WSH.StdErr.WriteLine "序号=" & item.Tag
WSH.StdErr.WriteLine "容量=" & FormatSize(item.Capacity)
WSH.StdErr.WriteLine "主频=" & item.Speed
WSH.StdErr.WriteLine "制造商=" & item.Manufacturer
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============物理硬盘============"
Set query=wmi.ExecQuery("Select * from Win32_DiskDrive")
For each item in query
WSH.StdErr.WriteLine "名称=" & item.Caption
WSH.StdErr.WriteLine "接口=" & item.InterfaceType
WSH.StdErr.WriteLine "容量=" & FormatSize(item.Size)
WSH.StdErr.WriteLine "分区数=" & item.Partitions
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine "============硬盘逻辑分区============"
Set query=wmi.ExecQuery("Select * from Win32_LogicalDisk Where DriveType=3 or DriveType=2")
For each item in query
WSH.StdErr.WriteLine item.Caption & Chr(9) & item.FileSystem & Chr(9) & FormatSize(item.Size) & Chr(9) & FormatSize(item.FreeSpace)
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============网卡============"
Set query=wmi.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionID !=null and not Name like '%Virtual%'")
For each item in query
WSH.StdErr.WriteLine "名称=" & item.Name
WSH.StdErr.WriteLine "连接名=" & item.NetConnectionID
WSH.StdErr.WriteLine "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.StdErr.WriteLine "IP=" & item2.IPAddress(0)
End If
Next
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============显卡============"
Set query=wmi.ExecQuery("Select * from Win32_VideoController")
For each item in query
WSH.StdErr.WriteLine "名称=" & item.Name
WSH.StdErr.WriteLine "显存=" & FormatSize(Abs(item.AdapterRAM))
WSH.StdErr.WriteLine "当前刷新率=" & item.CurrentRefreshRate
WSH.StdErr.WriteLine "水平分辨率=" & item.CurrentHorizontalResolution
WSH.StdErr.WriteLine "垂直分辨率=" & item.CurrentVerticalResolution
WSH.StdErr.WriteLine '\n'
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============声卡============"
Set query=wmi.ExecQuery("Select * from WIN32_SoundDevice")
For each item in query
WSH.StdErr.WriteLine item.Name
Next
WSH.StdErr.WriteLine '\n'
WSH.StdErr.WriteLine "============打印机============"
Set query=wmi.ExecQuery("Select * from Win32_Printer")
For each item in query
If item.Default =True Then
WSH.StdErr.WriteLine item.Name & "(默认)"
Else
WSH.StdErr.WriteLine item.Name
End If
Next
WSH.echo " 电脑信息已经收集完成!"
WSH.echo "============================"
WSH.Quit
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
*/
DOS批处理命令,自动获取本机系统及硬件配置信息的更多相关文章
- DOS批处理命令判断操作系统版本、执行各版本对应语句
DOS批处理命令判断操作系统版本.执行各版本对应语句 昨天在家里试用 netsh interface ip set address 这些命令更改上网IP.DNS.网关等,今天将那些代码拿来办公室 ...
- DOS批处理命令递归删除给定的文件(夹),兼VC工程清理小工具
使用dos批处理命令递归删除指定的文件(夹): (下面内容针对清理VC工程!自己按说明任意修改) 2014-06-10修改:删除前增加了[y,n]询问: echo off rem 递归删除当前文件下指 ...
- Shell 命令行获取本机IP,grep的练习
Shell 命令行获取本机IP,grep的练习 在 mac 下面输入 ifconfig 或者在 linux 下面输入 ip a 就可以得到我们的网卡信息.不过通常情况下,我们需要查看的是我们的IP地址 ...
- C/C++通过WMI和系统API函数获取获取系统硬件配置信息
转载:http://www.cnblogs.com/renyuan/archive/2012/12/29/2838716.html 转载:http://blog.csdn.net/jhqin/arti ...
- Linux命令之lsb_release - 查看当前系统的发行版信息
用途说明 lsb_release命令用来查看当前系统的发行版信息(prints certain LSB (Linux Standard Base) and Distribution informati ...
- C#程序中获取电脑硬件配置信息的一种方法
本文介绍获取cpu信息和内存信息的方法,根据本文所举例的代码可以举一反三获取更多信息. 获取cpu名称的方法: public string GetCpuInfo() { ManagementObjec ...
- .NetCore获取Json和Xml格式的配置信息
本篇将和大家分享的是:如何获取Json和Xml格式的配置信息,主要介绍的是Configuration扩展方法的使用,因为netcore的web应用在Startup中已经默认嵌入appsettings. ...
- cocos2d-x教程3:用php或DOS批处理命令来转换文件和解压缩zip
在cocos2d-x使用中,须要不停的转换文件和压缩或解压文件.假设全人工来做,太麻烦了,且easy出错. 我如今把一些用的到批处理贴出来,供大家使用 自己主动把dat文件按数字排序重命名gz.DOS ...
- DOS批处理命令-几个固定名称的变量
批处理中有一些变量的变量名称是固定的,具有特定的意义,接下来,我们来看看这些有特定意义的变量到底有什么意义. 1.%CD% 当前路径的路径名[盘符 + 路径] - 現在のディレクトリ文字列に ...
- DOS批处理命令-if语句
IF语句是批处理中执行的条件分歧处理. 批处理中,IF分歧的写法有好几种,接下来,我们来一个一个的分析IF语法的结构. 1.IF [NOT] ERRORLEVEL 番号 批处理命令 当ERRORLEV ...
随机推荐
- 基于WebGL的方式使用OpenLayers
1. 引言 在绘制海量数据时,使用GPU进行绘制可有效减少CPU的负载,提升绘制时的速度在浏览器中,可以使用WebGL的方式与GPU交互 OpenLayers是一个常用的GIS相关的JavaScrip ...
- unity resMgr
yooAsset GitHub - tuyoogame/YooAsset: unity3d resources management system xAsset GitHub - xasset/xas ...
- 关于js对象的键
面试的时候,多次被问到Object和Map的区别,我都没答上,我以为可能问原理的可能多一些... 于是今天就仔细地看了一下Object和Map的区别.网上各文章都说Object的键只能是字符串或Sym ...
- 原生javascript解锁恶心的CSDN强制关注才能阅读让文章自动展开(转部分内容)
此时你可以打开chrome浏览器的开发者工具 快捷键F12, 然后切换到Console界面 然后复制上面的javascript代码 var article_content=document.getEl ...
- Python elasticsearch 报错及解决方法
1. ERROR: [1] bootstrap checks failed [1]: the default discovery settings are unsuitable for product ...
- Kubernetes v1.22 编译 kubeadm 修改证书有效期到 100 年
此方法支持以下 kubeadm版本 v1.22到v1.25 kubeadm 默认证书为一年,一年过期后,会导致 api service 不可用,使用过程中会出现:x509: certificate h ...
- 不用PyScript,网页端运行的Python编辑器
原文:https://lwebapp.com/zh/python-online 需求 有小伙伴可能听说过 PyScript,知道了Python可以通过打包成wasm运行在浏览器端了,这样做一些需要Py ...
- ACE下载地址
https://download.dre.vanderbilt.edu/previous_versions/ 在某n中找了大半天愣是没人贴出来
- vue实现记录分享是否有上级
前言: 项目需要做活动分享功能(增加网站.app等访问量),但是,,,无功不受禄,也就需要分享时带上级ID,好友中奖,本人也受同样优惠 需求开发: 开发一个活动后,本人参加之后,分享给好友,增加自身中 ...
- 前端使用axios如何提交表单请求
//使用FormData创建参数 let formData = new FormData(); formData.append("jsonData", JSON.stringify ...