Shell.Application BrowseForFolder - how do I get full path of Folder object?

廉价感情. 提交于 2019-12-23 01:30:49

问题


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?

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

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


回答1:


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


来源:https://stackoverflow.com/questions/31904226/shell-application-browseforfolder-how-do-i-get-full-path-of-folder-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!