一款win7以上计算机信息采集脚本
新建文本文件,复制代码,保存为vbs扩展名的文件,注意编码格式选择Unicode,专业版亲测能用if msgbox("采集计算机信息需要花费一定的时间,请耐心等待。"& vbCrLf & vbCrLf &"确认采集点击【是】,退出点击【否】",4164,"计算机信息采集脚本") = 7 then
wscript.quit
end if
'on error resume next
'======================参数设置======================
bat_file="msinfo.bat"'运行msinfo32的bat文件名。
port_file="msinfo.txt"'msinfo32提取的报告文件名。
info_file="computer_info.txt"'采集的信息保存文件名。
bs=""'大类开头分割符。
bt="|"'大类中间分割符。
es=""'大类结尾分割符。
lbs="{"'小类开头分割符。
lbt=";"'小类中间分割符。
les="}"'小类结尾分割符。
tbs="["'分项开头分割符。
tbt=""'分项中间分割符。
tes="]"'分项结尾分割符。
sbs=":"'子项开头分割符。
ses=""'子项结尾分割符。
sms="-"'子网掩码分隔符。
fss="/"'分区信息分隔符。
fbs="(分区数:"'分区数量开头分隔符。
fes=")"'分区数量结尾分隔符。
is_st=0'小类为一类时,是否使用小类开头和结尾分隔符,值为1使用,值为0不使用。
ve=0'[内部版本]值为1采集,值为0不采集。
cp=0'值为1采集,值为0不采集。
cd=0'媒体类型为UNKNOWN时,值为1采集,值为0不采集。
ad=1'[声音设备]值为1只采集状态为OK值,值为0采集所有值。
vd=1'[显示]值为1只采集适配器内存有资料的值,值为0采集所有值。
re=1'[分辨率]值为1采集,值为0不采集。
da=1'[网络]值为1只采集IP地址和适配器类型有资料的值,值为0采集所有值。
ip=1'值为1采集,值为0不采集。
sm=0'值为1采集,值为0不采集。
gw=0'[网关]值为1采集,值为0不采集。
dh=0'值为1采集,值为0不采集。
ds=0'值为1采集,值为0不采集。
mc=1'值为1采集,值为0不采集。
prg=0 '[打印驱动程序]值为1采集,值为0不采集。
prp=1 '[打印端口名]值为1采集,值为0不采集。
prs=0 '[打印服务器名称]值为1采集,值为0不采集。
dk=0'[磁盘类型]值为1采集,值为0不采集。
df=1'[磁盘空间]值为1采集,值为0不采集。
fs=0'[磁盘分区]值为1采集,值为0不采集。
xy=1'[多行写入文件]值为1单行,值为0多行。
is_na=0 '[显示中文类别名称]值为1显示,值为0不显示。
is_dt=1'[显示采集日期]值为1显示,值为0不显示。
is_txt=3'[保存文件格式]值为1保存为txt,值为2保存为excel,值为3两种格式都保存。
is_typ=1'值为1为xlsx格式,值为0为xls格式。
is_wid=0',大于零设置列宽,否则不予设置。
na_1="操作系统名称:"'默认第一顺序采集信息(顺序代码1)。
na_2="版本:"'默认第二顺序采集信息(顺序代码2)。
na_3="主板制造商:"'默认第三顺序采集信息(顺序代码3)。
na_4="系统型号:"'默认第四顺序采集信息(顺序代码4)。
na_5="处理器:"'默认第五顺序采集信息(顺序代码5)。
na_6="平台角色:"'默认第六顺序采集信息(顺序代码6)。
na_7="已安装的物理内存(RAM):"'默认第七顺序采集信息(顺序代码7)。
na_8="CD-ROM:"'默认第八顺序采集信息(顺序代码8)。
na_9="声音设备:"'默认第九顺序采集信息(顺序代码9)。
na_10="显示:"'默认第十顺序采集信息(顺序代码A)。
na_11="网络:"'默认第十一顺序采集信息(顺序代码B)。
na_12="磁盘:"'默认第十二顺序采集信息(顺序代码C)。
na_13="打印:"'默认第十三顺序采集信息(顺序代码D)。
sort_s="31-61-41-51-C1-71-B1-A1-81-91-11-20-D0" '排序参数,两位为一组(共13组26位),每组第一位为顺序代码,第二位为显示(隐藏)代码
'sort_s默认值:"11-21-31-41-51-61-71-81-91-A1-B1-C1-D1",全部显示。
'=================================================
DIM dir,fso,f,l1,fdi
'获取当前路径
dir = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
path=dir&"\"&port_file
'l1参数为运行info.bat时关闭弹出的cmd窗口
l1="%1 mshta vbscript:CreateObject("+chr(34)+"WScript.Shell"+chr(34)+").Run("+chr(34)+"%~s0 ::"+chr(34)+",0,FALSE)(window.close)&&exit"
'不存在则写采集文件
set fso = CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(dir&"\"&bat_file) then
set f = fso.CreateTextFile(dir&"\"&bat_file, true)
f.WriteLine(l1& vbCrLf &"msinfo32 /report "&path)
f.Close()
set f = nothing
set fso = nothing
Set wim =nothing
end if
CreateObject("Shell.Application").ShellExecute dir&"\"&bat_file,"","","runas",1 '管理员身份运行bat_file
'提取等待提示
info_per=InputBox("正在提取Microsoft 系统信息,请耐心等待。"& vbCrLf & vbCrLf &"提取信息的同时可以输入使用人员和显示器信息"& vbCrLf & vbCrLf &"提取结束点击【确定】,退出操作点击【取消】","Microsoft 系统信息 (Msinfo32.exe)提取中","编号|科室|姓名|显示器品牌|显示器型号")
if info_per="" then wscript.quit
set fso = CreateObject("Scripting.FileSystemObject")
Set A=fso.OpenTextFile(path,1,0,-1)
For i=1 To 3200
info_con=A.ReadLine
if Left(info_con,6)="操作系统名称" then
ms1=Trim(Replace(info_con,"操作系统名称","",1,1))
ms1=Trim(Replace(ms1," ",""))
if len(ms1)>0 and is_st=1 then ms1=lbs&ms1&les
fz="操作系统名称"
end if
if Left(info_con,2)="版本" and fz="操作系统名称" then
fz=""
ms2=Trim(Replace(info_con,"版本","",1,1))
ms2=Trim(Replace(ms2," ",""))
if ve=0 then
ms2=mid(ms2,1,instr(ms2,"内部版本") - 1)
end if
if len(ms2)>0 and is_st=1 then ms2=lbs&ms2&les
end if
if Left(info_con,5)="主板制造商" then
ms3=Trim(Replace(info_con,"主板制造商","",1,1))
ms3=Trim(Replace(ms3," ",""))
if len(ms3)>0 and is_st=1 then ms3=lbs&ms3&les
end if
if Left(info_con,4)="系统型号" then
ms4=Trim(Replace(info_con,"系统型号","",1,1))
ms4=Trim(Replace(ms4," ",""))
if len(ms4)>0 and is_st=1 then ms4=lbs&ms4&les
end if
if Left(info_con,3)="处理器" then
ms5=Trim(Replace(info_con,"处理器","",1,1))
ms5=Trim(Replace(ms5," ",""))
if cp=0 then
ms5=mid(ms5,1,instr(ms5,",") - 1)
end if
if len(ms5)>0 and is_st=1 then ms5=lbs&ms5&les
end if
if Left(info_con,4)="平台角色" then
ms6=Trim(Replace(info_con,"平台角色","",1,1))
ms6=Trim(Replace(ms6," ",""))
if len(ms6)>0 and is_st=1 then ms6=lbs&ms6&les
end if
if Left(info_con,13)="已安装的物理内存(RAM)" then
ms7=Trim(Replace(info_con,"已安装的物理内存(RAM)","",1,1))
ms7=Trim(Replace(ms7," ",""))
if len(ms7)>0 and is_st=1 then ms7=lbs&ms7&les
end if
if Trim(info_con)="" then fz=""
if Left(info_con,4)="媒体类型" and fz="" then
ms81=Trim(Replace(info_con,"媒体类型","",1,1))
ms81=Trim(Replace(ms81," ",""))
if cd = 1 then
if Len(ms8)>0 then
ms8=lbs&ms8&les&lbt&lbs&ms81
cd_qu=2
else
ms8=ms81
cd_qu=1
end if
else
if Trim(ms81)<>"UNKNOWN" then
if Len(ms8)>0 then
ms8=lbs&ms8&les&lbt&lbs&ms81
cd_qu=2
else
ms8=ms81
cd_qu=1
end if
end if
end if
end if
if Left(info_con,2)="名称" and fz="" then
ms82=Trim(Replace(info_con,"名称","",1,1))
ms82=Trim(Replace(ms82," ",""))
if cd = 1 then
if cd_qu=1 then ms8=ms8&sbs&ms82&ses
if cd_qu=2 then ms8=ms8&sbs&ms82&ses&les
else
if Trim(ms81)<>"UNKNOWN" then
if cd_qu=1 then ms8=ms8&sbs&ms82&ses
if cd_qu=2 then ms8=ms8&sbs&ms82&ses&les
end if
end if
if is_st=1 and cd_qu=1 and left(ms8,len(lbs))<>lbs then ms8=lbs&ms8&les'一个分类使用分隔符时加上分隔符
end if
if Trim(info_con)="[声音设备]" then fz="[声音设备]"
if Left(info_con,2)="名称" and fz="[声音设备]" then
ms91=Trim(Replace(info_con,"名称","",1,1))
ms91=Trim(Replace(ms91," ",""))
end if
if Left(info_con,2)="状态" and fz="[声音设备]" then
ms92=Trim(Replace(info_con,"状态","",1,1))
ms92=Trim(Replace(ms92," ",""))
if ad = 1 then
if Trim(ms92)="OK" then
if Len(ms9)>0 then
ms9=lbs&ms9&les&lbt&lbs&ms91&les
sd_qu=2
else
ms9=ms91
sd_qu=1
end if
end if
else
if Len(ms9)>0 then
ms9=lbs&ms9&les&lbt&lbs&ms91&les
sd_qu=2
else
ms9=ms91
sd_qu=1
end if
end if
if is_st=1 and sd_qu=1 and left(ms9,len(lbs))<>lbs then ms9=lbs&ms9&les'一个分类使用分隔符时加上分隔符
end if
if Trim(info_con)="[显示]" then fz="[显示]"
if Left(info_con,2)="名称" and fz="[显示]" then
ms101=Trim(Replace(info_con,"名称","",1,1))
ms101=Trim(Replace(ms101," ",""))
end if
if Left(info_con,5)="适配器内存" and fz="[显示]" then
ms102=Trim(Replace(info_con,"适配器内存","",1,1))
ms102=Trim(Replace(ms102," ",""))
if vd = 1 then
if Trim(ms102)<>"没有资料" then
if Len(ms10)>0 then
ms10=lbs&ms10&les&lbt&lbs&ms101
vd_qu=2
else
ms10=ms101
vd_qu=1
end if
end if
else
if Len(ms10)>0 then
ms10=lbs&ms10&les&lbt&lbs&ms101
vd_qu=2
else
ms10=ms101
vd_qu=1
end if
end if
end if
if Left(info_con,3)="分辨率" and fz="[显示]" and re=1 then
ms103=Trim(Replace(info_con,"分辨率","",1,1))
ms103=Trim(Replace(ms103," ",""))
if vd = 1 then
if Trim(ms102)<>"没有资料" then
if vd_qu=1 then ms10=ms10&sbs&ms103&ses
if vd_qu=2 then ms10=ms10&sbs&ms103&ses&les
end if
else
if vd_qu=1 then ms10=ms10&sbs&ms103&ses
if vd_qu=2 then ms10=ms10&sbs&ms103&ses&les
end if
if is_st=1 and vd_qu=1 and left(ms10,len(lbs))<>lbs then ms10=lbs&ms10&les'一个分类使用分隔符时加上分隔符
end if
if Trim(info_con)="[网络]" then fz="[网络]"
if Left(info_con,5)="适配器类型" and fz="[网络]" then
ms111=Trim(Replace(info_con,"适配器类型","",1,1))
ms111=Trim(Replace(ms111," ",""))
end if
if Left(info_con,4)="产品类型" and fz="[网络]" then
ms112=Trim(Replace(info_con,"产品类型","",1,1))
ms112=Trim(Replace(ms112," ",""))
end if
if Left(info_con,5)="IP 地址" and fz="[网络]" then
ms113=Trim(Replace(info_con,"IP 地址","",1,1))
ms113=Trim(Replace(ms113," ",""))
if Trim(ms113)<>"没有资料" then
ms113=mid(ms113,1,instr(ms113,", ") - 1) '报告包含Ipv4和Ipv6的IP地址,截取Ipv4的IP地址
end if
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if Len(ms11)>0 then
if ip=1 then
if ip+sm+gw+dh+ds+mc=1 then
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs&ms113
else
ms11=ms11&les&lbt&lbs&ms112&sbs&ms113
end if
else
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs&tbs&ms113&tes
else
ms11=ms11&les&lbt&lbs&ms112&sbs&tbs&ms113&tes
end if
end if
else
if ip+sm+gw+dh+ds+mc=0 then
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112
else
ms11=ms11&les&lbt&lbs&ms112
end if
else
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs
else
ms11=ms11&les&lbt&lbs&ms112&sbs
end if
end if
end if
da_qu=2
else
if ip=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms112&sbs&ms113
else
ms11=ms112&sbs&tbs&ms113&tes
end if
else
ms11=ms112&sbs
end if
da_qu=1
end if
end if
else
if Len(ms11)>0 then
if ip=1 then
if ip+sm+gw+dh+ds+mc=1 then
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs&ms113
else
ms11=ms11&les&lbt&lbs&ms112&sbs&ms113
end if
else
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs&tbs&ms113&tes
else
ms11=ms11&les&lbt&lbs&ms112&sbs&tbs&ms113&tes
end if
end if
else
if ip+sm+gw+dh+ds+mc=0 then
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112
else
ms11=ms11&les&lbt&lbs&ms112
end if
else
if right(ms11,len(les))=les then
ms11=ms11&lbt&lbs&ms112&sbs
else
ms11=ms11&les&lbt&lbs&ms112&sbs
end if
end if
end if
da_qu=2
else
if ip=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms112&sbs&ms113
else
ms11=ms112&sbs&tbs&ms113&tes
end if
else
ms11=ms112&sbs
end if
da_qu=1
end if
end if
end if
if Left(info_con,5)="IP 子网" and fz="[网络]" then
ms114=Trim(Replace(info_con,"IP 子网","",1,1))
ms114=Trim(Replace(ms114," ",""))
if ms114<>"没有资料" then
ms114=mid(ms114,1,instr(ms114,", ") - 1)
end if
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if sm=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms114
else
if ip=1 then
ms11=ms11&tbt&tbs&ms114&tes
else
ms11=ms11&tbs&ms114&tes
end if
end if
end if
end if
else
if sm=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms114
else
if ip=1 then
ms11=ms11&tbt&tbs&ms114&tes
else
ms11=ms11&tbs&ms114&tes
end if
end if
end if
end if
end if
if Left(info_con,8)="默认 IP 网关" and fz="[网络]" then
ms115=Trim(Replace(info_con,"默认 IP 网关","",1,1))
ms115=Trim(Replace(ms115," ",""))
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if gw=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms115
else
if ip+sm>0 then
ms11=ms11&tbt&tbs&ms115&tes
else
ms11=ms11&tbs&ms115&tes
end if
end if
end if
end if
else
if gw=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms115
else
if ip+sm>0 then
ms11=ms11&tbt&tbs&ms115&tes
else
ms11=ms11&tbs&ms115&tes
end if
end if
end if
end if
end if
if Left(info_con,8)="DHCP 已启用" and fz="[网络]" then
ms116=Trim(Replace(info_con,"DHCP 已启用","",1,1))
ms116=Trim(Replace(ms116," ",""))
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if dh=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms116
else
if ip+sm+gw>0 then
ms11=ms11&tbt&tbs&ms116&tes
else
ms11=ms11&tbs&ms116&tes
end if
end if
end if
end if
else
if dh=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms116
else
if ip+sm+gw>0 then
ms11=ms11&tbt&tbs&ms116&tes
else
ms11=ms11&tbs&ms116&tes
end if
end if
end if
end if
end if
if Left(info_con,8)="DHCP 服务器" and fz="[网络]" then
ms117=Trim(Replace(info_con,"DHCP 服务器","",1,1))
ms117=Trim(Replace(ms117," ",""))
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if ds=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms117
else
if ip+sm+gw+dh>0 then
ms11=ms11&tbt&tbs&ms117&tes
else
ms11=ms11&tbs&ms117&tes
end if
end if
end if
end if
else
if ds=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms117
else
if ip+sm+gw+dh>0 then
ms11=ms11&tbt&tbs&ms117&tes
else
ms11=ms11&tbs&ms117&tes
end if
end if
end if
end if
end if
if Left(info_con,6)="MAC 地址" and fz="[网络]" then
ms118=Trim(Replace(info_con,"MAC 地址","",1,1))
ms118=Trim(Replace(ms118," ",""))
ms118=Trim(Replace(ms118,":",sms))
if da = 1 then
if Trim(ms113)<>"没有资料" and Trim(ms111)<>"没有资料" then
if mc=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms118
else
ms11=ms11&tbt&tbs&ms118&tes
end if
end if
end if
else
if mc=1 then
if ip+sm+gw+dh+ds+mc=1 then
ms11=ms11&ms118
else
ms11=ms11&tbt&tbs&ms118&tes
end if
end if
end if
if len(ms11)>0 and (is_st=1 or da_qu=2) and left(ms11,len(lbs))<>lbs then ms11=lbs&ms11'一个分类使用分隔符时加上分隔符
if len(ms11)>0 and (is_st=1 or da_qu=2) and right(ms11,len(les))<>les then ms11=ms11&les'一个分类使用分隔符时加上分隔符
end if
if Trim(info_con)="[磁盘]" then fz="[磁盘]"
if Left(info_con,2)="模式" and fz="[磁盘]" then
ms121=Trim(Replace(info_con,"模式","",1,1))
ms121=Trim(Replace(ms121," ",""))
ms1241=""
if Len(ms12)>0 then
if right(ms12,len(les))<>les then
ms12=ms12&les&lbt&lbs&ms121&sbs
else
ms12=ms12&lbt&lbs&ms121&sbs
end if
fs_qu=2
else
ms12=ms121&sbs
fs_qu=1
end if
end if
if Left(info_con,4)="媒体类型" and fz="[磁盘]" then
ms122=Trim(Replace(info_con,"媒体类型","",1,1))
ms122=Trim(Replace(ms122," ",""))
if dk = 1 then
if dk+df+fs=1 then
ms12=ms12&ms122
else
ms12=ms12&tbs&ms122&tes
end if
end if
flx=1 '用来筛选分区性质:是分区数(值为1)还是分区大小(值为0)
end if
if Left(info_con,2)="分区" and flx=1 then
fdi=Trim(Replace(info_con,"分区","",1,1)) '获取分区数量
fdi=Trim(Replace(fdi," ",""))
flx=0
end if
if Left(info_con,2)="大小" and fz="[磁盘]" then
ms123=Trim(Replace(info_con,"大小","",1,1)) '获取磁盘大小
ms123=Trim(Replace(ms123," ",""))
ms123=Trim(mid(ms123,1,instr(ms123,"(") - 1))
if df = 1 then
if dk+df+fs=1 then
ms12=ms12&ms123
else
if dk=0 then
ms12=ms12&tbs&ms123&tes
else
ms12=ms12&tbt&tbs&ms123&tes
end if
end if
end if
end if
if Left(info_con,4)="分区大小" and fz="[磁盘]" then
ms124=Trim(Replace(info_con,"分区大小","",1,1)) '获取分区大小
ms124=Trim(Replace(ms124," ",""))
ms124=Trim(mid(ms124,1,instr(ms124,"(") - 1))
if fs = 1 then
if len(ms1241)=0 then
ms1241=fbs&fdi&fes&ms124
else
ms1241=ms1241&fss&ms124
end if
end if
end if
if (Left(info_con,2)="描述" and fz="[磁盘]") or Trim(info_con)="" then
if fs = 1 and len(ms1241)>0 then
if dk+df+fs=1 then
ms12=ms12&ms1241
else
ms12=ms12&tbt&tbs&ms1241&tes
end if
end if
if len(ms12)>0 and (is_st=1 or fs_qu=2) and left(ms12,len(lbs))<>lbs then ms12=lbs&ms12'一个分类使用分隔符时加上分隔符
if len(ms12)>0 and (is_st=1 or fs_qu=2) and right(ms12,len(les))<>les then ms12=ms12&les'一个分类使用分隔符时加上分隔符
end if
if Trim(info_con)="" thenfz=""
if Trim(info_con)="[打印]" then fz="[打印]"
if Trim(info_con)="[有问题的设备]"then fz=[有问题的设备]
if Left(info_con,2)<>"名称" and Trim(info_con)<>"[打印]" and fz="[打印]" and Trim(info_con)<> "" then
ms131=Trim(Replace(info_con," ","/**/"))
if InStr(ms131,"/**/")>0 then ms132=mid(ms131,1,InStr(ms131,"/**/")-1)
ms131=Replace(ms131,ms132&"/**/","",1,1)
if InStr(ms131,"/**/")>0 then ms133=mid(ms131,1,InStr(ms131,"/**/")-1)
ms131=Replace(ms131,ms133&"/**/","",1,1)
if InStr(ms131,"/**/")>0 then ms134=mid(ms131,1,InStr(ms131,"/**/")-1)
ms131=Replace(ms131,ms134&"/**/","",1,1)
if InStr(ms131,"/**/")>0 then ms135=mid(ms131,1,InStr(ms131,"/**/")-1)
if len(ms13)=0 then
pr_qu=1
else
pr_qu=2
end if
if prg=1 then
if len(ms13)=0 then
ifprg+prp+prs=1 then
ms13=ms132&sbs&ms133
else
ms13=ms132&sbs&tbs&ms133&tes
end if
else
ifprg+prp+prs=1 then
if right(ms13,len(les))=les then
ms13=ms13&lbt&lbs&ms132&sbs&ms133
else
ms13=ms13&les&lbt&lbs&ms132&sbs&ms133
end if
else
if right(ms13,len(les))=les then
ms13=ms13&lbt&lbs&ms132&sbs&tbs&ms133&tes
else
ms13=ms13&les&lbt&lbs&ms132&sbs&tbs&ms133&tes
end if
end if
end if
else
if len(ms13)=0 then
ifprg+prp+prs=0 then
ms13=ms132
else
ms13=ms132&sbs
end if
else
ifprg+prp+prs=0 then
if right(ms13,len(les))=les then
ms13=ms13&lbt&lbs&ms132
else
ms13=ms13&les&lbt&lbs&ms132
end if
else
if right(ms13,len(les))=les then
ms13=ms13&lbt&lbs&ms132&sbs
else
ms13=ms13&les&lbt&lbs&ms132&sbs
end if
end if
end if
end if
if prp=1 then
ifprg+prp+prs=1 then
ms13=ms13&ms134
else
if prg=1 then
ms13=ms13&tbt&tbs&ms134&tes
else
ms13=ms13&tbs&ms134&tes
end if
end if
end if
if prs=1 then
ifprg+prp+prs=1 then
ms13=ms13&ms135
else
ms13=ms13&tbt&tbs&ms135&tes
end if
end if
if len(ms13)>0 and (is_st=1 or pr_qu=2) and left(ms13,len(lbs))<>lbs then ms13=lbs&ms13'一个分类使用分隔符时加上分隔符
if len(ms13)>0 and (is_st=1 or pr_qu=2) and right(ms13,len(les))<>les then ms13=ms13&les'一个分类使用分隔符时加上分隔符
end if
Next
if is_na<>1 then
na_1=""
na_2=""
na_3=""
na_4=""
na_5=""
na_6=""
na_7=""
na_8=""
na_9=""
na_10=""
na_11=""
na_12=""
na_13=""
end if
t_s=mid(sort_s,3,1)
if t_s<>"1" and t_s<>"2" and t_s<>"3" and t_s<>"4" and t_s<>"5" and t_s<>"6" and t_s<>"7" and t_s<>"8" and t_s<>"9" and t_s<>"A" and t_s<>"B" and t_s<>"C" and t_s<>"D" then sort_s=Replace(sort_s,mid(sort_s,3,1),"")
For j=1 To 13
select case mid(sort_s,2*j-1,1)
case "1"
is_os=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_os=1 then ms=ms&na_1&bs&ms1&es&bt
else
if is_os=1 then ms=ms&vbCrLf&na_1&bs&ms1&es&bt
end if
case "2"
is_vr=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_vr=1 then ms=ms&na_2&bs&ms2&es&bt
else
if is_vr=1 then ms=ms&vbCrLf&na_2&bs&ms2&es&bt
end if
case "3"
is_fc=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_fc=1 then ms=ms&na_3&bs&ms3&es&bt
else
if is_fc=1 then ms=ms&vbCrLf&na_3&bs&ms3&es&bt
end if
case "4"
is_md=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_md=1 then ms=ms&na_4&bs&ms4&es&bt
else
if is_md=1 then ms=ms&vbCrLf&na_4&bs&ms4&es&bt
end if
case "5"
is_cp=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_cp=1 then ms=ms&na_5&bs&ms5&es&bt
else
if is_cp=1 then ms=ms&vbCrLf&na_5&bs&ms5&es&bt
end if
case "6"
is_js=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_js=1 then ms=ms&na_6&bs&ms6&es&bt
else
if is_js=1 then ms=ms&vbCrLf&na_6&bs&ms6&es&bt
end if
case "7"
is_rm=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_rm=1 then ms=ms&na_7&bs&ms7&es&bt
else
if is_rm=1 then ms=ms&vbCrLf&na_7&bs&ms7&es&bt
end if
case "8"
is_cd=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_cd=1 then ms=ms&na_8&bs&ms8&es&bt
else
if is_cd=1 then ms=ms&vbCrLf&na_8&bs&ms8&es&bt
end if
case "9"
is_sd=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_sd=1 then ms=ms&na_9&bs&ms9&es&bt
else
if is_sd=1 then ms=ms&vbCrLf&na_9&bs&ms9&es&bt
end if
case "A"
is_ds=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_ds=1 then ms=ms&na_10&bs&ms10&es&bt
else
if is_ds=1 then ms=ms&vbCrLf&na_10&bs&ms10&es&bt
end if
case "B"
is_dn=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_dn=1 then ms=ms&na_11&bs&ms11&es&bt
else
if is_dn=1 then ms=ms&vbCrLf&na_11&bs&ms11&es&bt
end if
case "C"
is_fd=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_fd=1 then ms=ms&na_12&bs&ms12&es&bt
else
if is_fd=1 then ms=ms&vbCrLf&na_12&bs&ms12&es&bt
end if
case "D"
is_pr=CInt(mid(sort_s,2*j,1))
if xy=1 then
if is_pr=1 then ms=ms&na_13&bs&ms13&es&bt
else
if is_pr=1 then ms=ms&vbCrLf&na_13&bs&ms13&es&bt
end if
end select
NEXT
ms=info_per&bt&ms
if is_dt=1 then ms=ms&Now()
if right(ms,len(bt))=bt then ms=mid(ms,1,len(ms)-len(bt))
if len(ms)>1024 then
sele=msgbox("文本超长会导致信息遗漏,请修改参数或修改脚本!"&vbCrLf&"继续保存点【是】,暂不保存查看信息点【否】,放弃保存点【取消】",4147 ,"信息文本超长!")
if sele=2 then wscript.quit
if sele=7 then
if msgbox(ms,4148 ,"信息文本超长![保存点是,放弃点否]")=7 then wscript.quit
end if
end if
'写采集信息文件
info_file=dir&"\"&info_file
if is_txt=1 or is_txt=3 then
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(info_file) then
set f = fso.OpenTextFile(info_file,8,false,-1) '第二个参数 2 表示重写,如果是 8 表示追加
else
set f = fso.CreateTextFile(info_file,,true)
end if
f.WriteLine(ms)
f.Close()
set f = nothing
set fso = nothing
Set wim =nothing
end if
if is_txt=2 or is_txt=3 then
if is_typ=1 then info_file=Replace(info_file,"txt","xlsx")
if is_typ=0 then info_file=Replace(info_file,"txt","xls")
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(info_file) then
Set ExcelApp=CreateObject("Excel.Application") '创建EXCEL对象
Set ExcelBook=ExcelApp.Workbooks.open(info_file)
Set ExcelSheet=ExcelBook.Worksheets(1) '添加工作页
else
Set ExcelApp=CreateObject("Excel.Application") '创建EXCEL对象
Set ExcelBook=ExcelApp.Workbooks.Add
Set ExcelSheet=ExcelBook.Worksheets(1) '添加工作页
ExcelSheet.Activate
ExcelApp.DisplayAlerts=False
ExcelSheet.Name="采集数据"
'ExcelSheet.Range("A1").Value = "------" '设置A1的值
end if
Const xlUp = -4162
LastRow = ExcelSheet.Cells(ExcelSheet.Rows.Count, 1).End(xlUp).Row'获取最后一行行数
ms_d=Replace(ms,"|",bt)
if is_wid>0 then ExcelSheet.Columns("A:Z").ColumnWidth = is_wid
if xy=1 then
For i=1 To 26
if len(ms_d)>0 then
if InStr(ms_d,bt)>0 then
ms_s=mid(ms_d,1,InStr(ms_d,bt)-1)
ExcelSheet.Range(Chr(i+64)&cstr(LastRow+1)).Value = ms_s '设置Excel值
ms_d=Replace(ms_d,ms_s&bt,"",1,1)
else
ExcelSheet.Range(Chr(i+64)&cstr(LastRow+1)).Value = ms_d '设置Excel值
ms_d=""
end if
end if
Next
else
For i=1 To 26
if len(ms_d)>0 then
if InStr(ms_d,bt)>0 then
ms_s=mid(ms_d,1,InStr(ms_d,bt)-1)
ExcelSheet.Range(Chr(65)&cstr(LastRow+i)).Value = ms_s '设置Excel值
ms_d=Replace(ms_d,ms_s&bt,"",1,1)
else
ExcelSheet.Range(Chr(65)&cstr(LastRow+i)).Value = ms_d '设置Excel值
ms_d=""
end if
end if
Next
end if
ExcelApp.application.displayalerts=false'关闭文件覆盖提示
ExcelBook.SaveAs info_file '保存工作表
ExcelApp.application.displayalerts=true'开启文件覆盖提示
ExcelBook.close
set excelApp=nothing
set ExcelBook=nothing
set ExcelSheet=nothing
end if
Dim WshShell
Set WshShell=CreateObject("Wscript.Shell")
WshSHell.popup"3 秒钟后本窗口将自动关闭!",3, "计算机信息采集成功", 4096
看你这些,应该是转载来的,而且,竟然还收费,也不会有太多会来看的,因此,还请根据自己的情况,做一下调整,谢谢 补充一下,还麻烦楼主,先去了解一下,什么叫做原创,什么叫做分享或转载,如果是真正原创,按照法律法规,还是有一定的法律效应,即别人在未经同意下,是无法炮制或复制等,只有取得授权或同意,才能复制转载或分享等(由于不是学法律,因此,简单略懂法律,但不会随便乱用标题前缀或后缀,如果有什么错误,还请自己去了解一下相关的法律法规,谢谢) 地球守护者 发表于 2021-11-9 21:34
看你这些,应该是转载来的,而且,竟然还收费,也不会有太多会来看的,因此,还请根据自己的情况,做一下调 ...
你找到和我一样的我吃了它,这脚本就是我自己写的,如果这不算原创那什么是原创? 地球守护者 发表于 2021-11-9 21:39
补充一下,还麻烦楼主,先去了解一下,什么叫做原创,什么叫做分享或转载,如果是真正原创,按照法律法规, ...
你可以去网上找,哪怕和我相近的,你都没看过脚本的原理在这和我谈法律?网上的大都是调用相关函数获取返回值取得相关信息,我这个是利用msinfo32生成的报告进行提取处理,就是网上过于简单我觉得不适合我才花时间自己写的,我付出劳动收点免费的金币有啥问题? tanglf188 发表于 2021-11-10 10:07
你找到和我一样的我吃了它,这脚本就是我自己写的,如果这不算原创那什么是原创? ...
你看清楚,我说了,我看了后,感觉是转载来的,好吗? tanglf188 发表于 2021-11-10 10:37
你可以去网上找,哪怕和我相近的,你都没看过脚本的原理在这和我谈法律?网上的大都是调用相关函数获取返 ...
我不是学法律,但是,一些略懂的基本,还是有的,谢谢 tanglf188 发表于 2021-11-10 10:37
你可以去网上找,哪怕和我相近的,你都没看过脚本的原理在这和我谈法律?网上的大都是调用相关函数获取返 ...
网上,想要重复的,想要简单的,实在是太多了,你明白吗? tanglf188 发表于 2021-11-10 10:37
你可以去网上找,哪怕和我相近的,你都没看过脚本的原理在这和我谈法律?网上的大都是调用相关函数获取返 ...
还有一点,你忘记在结尾处,做一个注释,以防止买了的或通过其他方式知道的,到处乱发或乱转载 tanglf188 发表于 2021-11-10 10:37
你可以去网上找,哪怕和我相近的,你都没看过脚本的原理在这和我谈法律?网上的大都是调用相关函数获取返 ...
简单来说,防止别人未经过同意,就拿去传播或转载等
页:
[1]
2