- set open=createobject("scripting.filesystemobject")
- str=inputbox("请输入文件(夹)名称或文件(夹)完整路径:",wscript.scriptname)
- if open.fileexists(str) then
- f1=open.getfile(str).size
- if f1<=1024 then
- sum=f1/1024
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- else
- if f1<=1024^2 then
- sum=f1/1024^2
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- else
- sum=f1/1024^2
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- end if
- end if
- else
- f2=open.getfolder(str).size
- if f2<=1024 then
- sum=f2/1024
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- else
- if f2<=1024^2 then
- sum=f2/1024^2
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- else
- sum=f2/1024^2
- t=split(sum,".")(0)&"."&left(split(sum,".")(1),2)
- end if
- end if
- end if
- msgbox round(t,2)&" MB",64,wscript.scriptname
复制代码
|