51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2110|回复: 3
打印 上一主题 下一主题

[求助] 请教QTP能否判断文件后缀名

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-8-7 14:19:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
现在我需要判断文件属性,如何区分exe后缀和txt后缀不同文件
谢谢高手了!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    无聊
    2015-3-12 14:20
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2009-8-7 14:59:59 | 只看该作者
    Scripting Runtime Library   

    FileSystemObject Objects
    The FileSystemObject (FSO) object model contains the following objects and collections.

    Object/Collection Description
    FileSystemObject Main object. Contains methods and properties that allow you to create, delete, gain information about, and generally manipulate drives, folders, and files. Many of the methods associated with this object duplicate those in other FSO objects; they are provided for convenience.
    Drive Object. Contains methods and properties that allow you to gather information about a drive attached to the system, such as its share name and how much room is available. Note that a "drive" isn't necessarily a hard disk, but can be a CD-ROM drive, a RAM disk, and so forth. A drive doesn't need to be physically attached to the system; it can be also be logically connected through a network.
    Drives Collection. Provides a list of the drives attached to the system, either physically or logically. The Drives collection includes all drives, regardless of type. Removable-media drives need not have media inserted for them to appear in this collection.
    File Object. Contains methods and properties that allow you to create, delete, or move a file. Also allows you to query the system for a file name, path, and various other properties.
    Files Collection. Provides a list of all files contained within a folder.
    Folder Object. Contains methods and properties that allow you to create, delete, or move folders. Also allows you to query the system for folder names, paths, and various other properties.
    Folders Collection. Provides a list of all the folders within a Folder.
    TextStream Object. Allows you to read and write text files.
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
    发表于 2009-8-7 15:53:31 | 只看该作者
    我以前的做法比较简单,用循环读取某个目录下所有的文件名,然后判断文件名中是否包含“.txt"或者".exe",虽然简单,但是很好用,
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
     楼主| 发表于 2009-8-10 10:15:57 | 只看该作者
    嗯,我现在的方法也是先获取文件名,然后用Instr来判断其中是包含exe还是txt
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-21 22:18 , Processed in 0.088649 second(s), 25 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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