在大学作毕业设计的课题是编制一个教学软件,所以很自然地和VB这种易学、易懂、界面友好漂亮的语言打上了交道该方法是将网络驱动器映射到本地
rem made by correy
rem made at 2007.9.22
rem it can be delete you computer's the follow things(except cd,dvd)
rem it can be delete empty file and folder
rem it can be delete .tmp ._mp .log .gid .chk .old file
rem it can be delete temp,recent,cookis,recycled,prefetch,and "Temporary Internet Files" folder.
rem i am thinking how to delete the same size and same name's file and folder
On Error GoTo 0
Set fso=CreateObject("Scripting"&"."&"FileSystem"&"Object")
for n=1 to 3
For Each d in fso.Drives
if d.drivetype=4 then
Exit For
else
scan(d)
end if
next
next
sub scan(folder)
on error resume next
set folder=fso.getfolder(folder)
for each file in folder.files
if file.size=0 then
file.delete(true)
end if
ext=fso.GetExtensionName(file)
ext=lcase(ext)
if ext="tmp" or ext="_mp" or ext="log" or ext="gid" or ext="chk" or ext="old" then ''30
file.delete(true)
end if
next
for each subfolder in folder.subfolders
rem instrRev() can't be used,i want to find "".
if left(subfolder.path,4)="temp" or left(subfolder.path,8)="recycled" then
subfolder.delete(true)
elseif left(subfolder.path,6)="recent" or left(subfolder.path,7)="cookis" then
subfolder.delete(true) rem 40
elseif left(subfolder.path,24)="Temporary Internet Files" or left(subfolder.path,8)="prefetch" then
subfolder.delete(true)
end if
if subfolder.size=0 then subfolder.delete(true)
scan(subfolder)
next
end sub
以上就是MicrosoftCommonDialogControl,Version6.0控件的具体使用方法,希望对读者有一定帮助
Message="Toworkcorrectly,thescriptwillclose"&vbCR
Message=Message&"andrestarttheWindowsExplorershell."&vbCR
Message=Message&"Thiswillnotharmyoursystem."&vbCR&vbCR
Message=Message&"Continue?"
X=MsgBox(Message,vbYesNo,"Notice")
IfX=6Then
OnErrorResumeNext
DimWSHShell,n,MyBox,p,t,errnum,vers
Dimitemtype
Dimenab,disab,jobfunc
SetWSHShell=WScript.CreateObject("WScript.Shell")
p="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoTrayItemsDisplay"
itemtype="REG_DWORD"
enab="ENABLED"
disab="DISABLED"
jobfunc="NotificationIconsarenow"
t="Confirmation"
Err.Clear
n=WSHShell.RegRead(p)
errnum=Err.Number
iferrnum<>0then
WSHShell.RegWritep,0,itemtype
EndIf
Ifn=0Then
n=1
WSHShell.RegWritep,n,itemtype
Mybox=MsgBox(jobfunc&disab&vbCR,4096,t)
ElseIfn=1then
n=0
WSHShell.RegWritep,n,itemtype
Mybox=MsgBox(jobfunc&enab&vbCR,4096,t)
EndIf
SetWshShell=Nothing
OnErrorGoTo0
ForEachProcessinGetObject("winmgmts:")._
ExecQuery("select*fromWin32_Processwherename='explorer.exe'")
Process.terminate(0)
Next
MsgBox"Finished."&vbcr&vbcr,4096,"Done"
Else
MsgBox"Nochangesweremadetoyoursystem."&vbcr&vbcr,4096,"UserCancelled"
EndIf
在主窗体的Form_load()中的最前面加入下列代码:
DimX0Aslong
DimY0AsLong
'让窗体居中
X0=Screen.Width
Y0=Screen.Height
X0=(X0-Me.Width)/2
Y0=(Y0-Me.Height)/2
Me.MoveX0,Y0->
如果您想了解有关WindowsUpdate(尤其是诸如Microsoft.Update.Session之类的对象)的详细信息,请参阅我们的“脚本故事”专栏中的我要得到你,我的美人…并且我们也要管理WindowsUpdate啦
可能的用法
查看和编辑在远程或本地数据库中的数据
'打开IE
'WshShell.SendKeys Chr(&H88AC)
'系统静音
'WshShell.SendKeys Chr(&H88AD)
'WshShell.SendKeys Chr(&H88AE)
'WshShell.SendKeys Chr(&H88AF)
'WshShell.SendKeys Chr(&H88B4)
'WshShell.SendKeys Chr(&H88B5)
'WshShell.SendKeys Chr(&H88B6)
'WshShell.SendKeys Chr(&H88B7)
反随机用
可将那些与特定窗体或控件无关的代码放入另一类型的模块——标准模块(文件扩展名为.BAS)中
OptionExplicit
OnErrorResumeNext
Subinclude(vbs)
Dimfso:Setfso=CreateObject("scripting.FileSystemObject")
Dimp:p=Split(Wscript.ScriptFullName,"")
p(UBound(p))=vbs
p=Join(p,"")
Dimf:Setf=fso.OpenTextFile(p)
Executef.ReadAll()
'ExecuteGlobalf.ReadAll()
f.Close()
Setf=Nothing
Setfso=Nothing
'Wscript.Echo(p)
EndSub
include("1.vbs")
include("2.vbs")
'IfErrThen
'Wscript.Echo(Err.description)
'Wscript.Quit()
'EndIf
Wscript.Echo(a+b)
1.vbs
a=3
2.vbs
b=4
。