找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3801|回复: 0

Read before check the file size

[复制链接]

96

主题

158

回帖

4

精华

核心会员

积分
6513
发表于 2012-6-6 05:33:04 | 显示全部楼层 |阅读模式

说明

范例指令档示范如何使用 FileSystemObject 在尝试读取一个文字档前,确保档案内容不是空的。本范例指令档必需在本机执行。

范例指令码

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\Windows\Netlogon.log")
If objFile.Size > 0 Then
    Set objReadFile = objFSO.OpenTextFile("C:\Windows\Netlogon.log", 1)
    strContents = objReadFile.ReadAll
    Wscript.Echo strContents
    objReadFile.Close
Else
    Wscript.Echo "The file is empty."
End If

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表