Shell.Application BrowseForFolder - 如何获取 Folder 对象的完整路径? [英] Shell.Application BrowseForFolder - how do I get full path of Folder object?

查看:37
本文介绍了Shell.Application BrowseForFolder - 如何获取 Folder 对象的完整路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下脚本,我使用 wscript 启动:

I have the following script, that I launch using wscript:

Set sh = CreateObject("Shell.Application")
Set rv = sh.BrowseForFolder(0, "Now browse...", 1)
WScript.Echo rv

如何获取所选文件夹的完整路径?

How can I obtain the full path of the selected folder?

的文档FolderBrowseForFolder 没有给出任何合适的内容.

The documentation for the Folder object that is returned by BrowseForFolder gives nothing appropriate.

或者也许我应该使用完全不同的东西来浏览 wscript...

Or maybe I should use something completely different for browsing for folders in wscript...

推荐答案

rv.Self.Path,这里有详细讨论:怎么可以我向用户显示一个仅允许他们选择文件夹的对话框? 嘿,脚本专家!博客.

rv.Self.Path, discussed here in detail: How Can I Show Users a Dialog Box That Only Lets Them Select Folders? at Hey, Scripting Guy! Blog.

Set sh = CreateObject("Shell.Application")
Set rv = sh.BrowseForFolder(0, "Now browse...", 1)
If rv Is Nothing Then
    WScript.Echo "Nothing chosen"
Else
    WScript.Echo rv.Self.Path
End If

这篇关于Shell.Application BrowseForFolder - 如何获取 Folder 对象的完整路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆