广州鸿名健康科技有限公司


vbs Size 属性使用介绍(获取文件大小)

网络编程 vbs Size 属性使用介绍(获取文件大小) 06-22

为大家介绍vbs属性之size属性,供大家学习参考。

Size 属性

对于文件,返回指定文件的字节数;对于文件夹,返回该文件夹中所有文件和子文件夹的字节数。方便我们判断文件的大小。

说明
object.Size
object 应为 File 或 Folder 对象的名称。

Folder 对象的 Size 属性示例:


Function ShowFolderSize(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(filespec)
s = UCase(f.Name) & " 大小为 " & f.size & " 字节。"
ShowFolderSize = s
End Function

vbs获取当前路径的代码
CMD当前路径test=createobject("Scripting.FileSystemObject").GetFolder(".").PathWscript.echotest当前VBS路径test=createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentF

vbs获取当前时间日期的代码
获取当前日期方法一:Currentdate1=date()msgboxCurrentdate1获取当前日期方法二:Currentdate2=year(Now)&"-"&Month(Now)&"-"&day(Now)msgboxCurrentdate2获取当前时间:CurrentTime=Ho

使用VBS获取当前日期的前一天 并修正输出格式
获取当前日期方法一:Currentdate1=date()msgboxCurrentdate1获取当前日期方法二:Currentdate2=year(Now)&"-"&Month(Now)&"-"&day(Now)msgboxCurrentdate2获取当前时间:CurrentTime=Ho


编辑:广州鸿名健康科技有限公司

标签:日期,属性,文件,字节,方法