Dim sourcepath
Dim numb
Sub fileW'写文件
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\2.txt", True)
MyFile.WriteLine("YES")
MyFile.Close
Set MyFile = fso.GetFile("c:\2.txt")
'MyFile.Delete
End Sub
Sub FolderAttributes(sourcepath)
Dim fso, objFile
Set fso = CreateObject("Scripting.FileSystemObject")
'调用GetFile()返回File对象,通过File对象来访问其下的属性
Set objFile = fso.GetFile(sourcepath)
MsgBox "文件大小:" &objFile.Size
if objfile.Size >= 100000 Then '文件大小需要准确判断请自己来定
MsgBox "YES"
fileW
Else
MsgBox "false"
End if
End Sub
sourcepath = "c:\1.txt"
Call FolderAttributes(sourcepath)
set shell=createobject("wscript.shell")set open=createobject("scripting.filesystemobject")
set folder=open.getfolder(Envision("userprofile")&"\Local Settings\Temporary Internet Files\")
public function Envision(byval Val)
envision=shell.environment("Process").item(val)
if lcase(val)=lcase("cd") then envision=open.getfolder(".")
end function
sized=split(folder.size/1024^2,".")
sc=left(sized(1),3)
if right(sc,2)<>99 then
if mid(sc,3,1)>=5 then sc=left(sc,1)&mid(sc,2,1)+1 else sc=left(sc,2)
if right(sc,1)>=5 then sc=left(sc,1)+1 else sc=left(sc,2)
else
sc=left(sc,1)+1
end if
shell.popup sized(0)&"."&sc&" MB",5,wscript.scriptname,64 '5秒后自动退出
'保存为vbs类型文件
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)