问题
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