今天偶然發(fā)現(xiàn)金庸網(wǎng)游的文件夾下的cur和ani格式的圖標(biāo)文件都不錯(cuò),于是把它們復(fù)制到C:\ye下,按照我的習(xí)慣,我會(huì)把文件名改名為1.cur,2.ani這樣的寫(xiě)法,于是想起來(lái)vbs腳本. 可以存放于任意目錄下.
------aa.vbs--------
dim fso,yexj00,s
s=0
set fso=createobject("Scripting.FileSystemObject") ‘聲明fso對(duì)象
set yexj00=fso.GetFolder("C:\ye\") ‘獲取文件夾對(duì)象,賦于yexj00
for each i in yexj00.files ‘循環(huán)玫舉yexj00文件夾對(duì)象下的所有子集,即文件.
if fso.GetExtensionName(i)="cur" or fso.GetExtensionName(i)="ani" then ‘如果擴(kuò)展名為cur或ani才執(zhí)行下面的操作,否則不操作
s=s+1 ‘s加1,此時(shí)s為數(shù)值
fso.GetFile(i).name=CStr(s)+"."+fso.GetExtensionName(i) ‘重命名文件名為理想格式,CStr(s)是將原先的數(shù)值s轉(zhuǎn)換為字符串.
end if
next
用WMI對(duì)象列出系統(tǒng)所有進(jìn)程:
----Instance.vbs----
Dim WMI,objs
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_Process")
For Each obj In objs
Enum1 = Enum1 + obj.Description + Chr(13) + Chr(10)
Next
msgbox Enum1
獲得物理內(nèi)存的容量:
-----physicalMemory.vbs-----
strComputer = "."
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each wbemObject In wbemObjectSet
WScript.Echo "物理內(nèi)存 (MB): " & CInt(wbemObject.TotalPhysicalMemory/1024)
Next
取得系統(tǒng)所有服務(wù)及運(yùn)行狀態(tài)
----service.vbs----
Set ServiceSet = GetObject("winmgmts:").InstancesOf("Win32_Service")
Dim s,infor
infor=""
for each s in ServiceSet
infor=infor+s.Description+" ==> "+s.State+chr(13)+chr(10)
next
msgbox infor
CPU的序列號(hào):
---CPUID.vbs---
Dim cpuInfo
cpuInfo = ""
set moc = GetObject("Winmgmts:").InstancesOf("Win32_Processor")
for each mo in moc
cpuInfo = CStr(mo.ProcessorId)
msgbox "CPU SerialNumber is : " & cpuInfo
next
硬盤(pán)型號(hào):
---HDID.vbs---
Dim HDid,moc
set moc =GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")
for each mo in moc
HDid = mo.Model
msgbox "硬盤(pán)型號(hào)為:" & HDid
next
網(wǎng)卡MAC物理地址:
---MACAddress.vbs---
Dim mc
set mc=GetObject("Winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
for each mo in mc
if mo.IPEnabled=true then
msgbox "網(wǎng)卡MAC地址是: " & mo.MacAddress
exit for
end if
next
測(cè)試你的顯卡:
On Error Resume Next
Dim ye
Dim yexj00
set yexj00=GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_VideoController")
for each ye in yexj00
msgbox "型 號(hào): " & ye.VideoProcessor & vbCrLf & "廠 商: " & ye.AdapterCompatibility & vbCrLf & "名 稱: " & ye.Name & vbCrLf & "狀 態(tài): " & ye.Status & vbCrLf & "顯 存: " & (ye.AdapterRAM\1024000) & "MB" & vbCrLf & "驅(qū) 動(dòng)(dll): " & ye.InstalledDisplayDrivers & vbCrLf & "驅(qū) 動(dòng)(inf): " & ye.infFilename & vbCrLf & "版 本: " & ye.DriverVersion
next