首页 > 开发 > 综合 > 正文

怎样得到一个系统盘的全名,不是字符,是全名,如:本地磁盘(C:)?

2024-07-21 02:16:16
字体:
来源:转载
供稿:网友
,欢迎访问网页设计爱好者web开发。
private sub command1_click()
    dim shellapp, opanel, folderitem1, folderitem2, oitem
    set shellapp = createobject("shell.application")
    set opanel = shellapp.namespace(0)

    set folderitem2 = nothing
    for each folderitem1 in opanel.items
      if folderitem1.name = "我的电脑" then
        set folderitem2 = folderitem1.getfolder: exit for
      end if
        debug.print folderitem1.name
    next

    if folderitem2 is nothing then
      msgbox "找不到项目!"
      exit sub
    end if

    set oitem = nothing
    for each oitem in folderitem2.items
        debug.print oitem.name
    next
end sub



输出结果如下:

控制面板3.5 软盘 (a:)windows98 (c:)程序 (d:)本地磁盘 (e:)数据备份 (f:)光盘 (g:)
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表