设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用WSH对象获取系统目录

1970-1-1 08:00| 发布者: goodidea『文章』| 查看: 2248| 评论: 0

你是不是很想知道操作系统相关的一些特殊目录位置?用WSH十分方便
请先引用 Windows Script Host Object Model    (%system%\wshom.ocx)

Sub PrintSpecialFolders()
'goodidea 2004/10/06

    Dim wsh As New WshShell
    Dim i As Integer

    For i = wsh.SpecialFolders.Count - 1 To 0 Step -1
        Debug.Print wsh.SpecialFolders(i)
    Next

    Debug.Print wsh.SpecialFolders("Desktop")   '获得桌面目录
  Debug.Print wsh.SpecialFolders("Fonts")   '获得系统字体目录
  Debug.Print wsh.SpecialFolders("Programs")   '获得程序菜单目录
  Debug.Print wsh.SpecialFolders("StartUp")   '获得程序启动目录
  Debug.Print wsh.SpecialFolders("Recent")   '获得最近使用文件目录
  Debug.Print wsh.SpecialFolders("FAVORITES")   '获得收藏夹目录
  Debug.Print wsh.SpecialFolders("SENDTO")   '获得发送到目录
  Debug.Print wsh.SpecialFolders("NETHOOD")   '获得网络邻居目录
  Debug.Print wsh.SpecialFolders("AppData")   '获得微软程序数据目录

end Sub

最新评论

相关分类

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-28 23:09 , Processed in 0.075967 second(s), 16 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部