Ansgar Wiechers' answer is helpful, but the title of File Explorer windows doesn't necessarily contain the full path of the location (folder) being displayed.
Somewhat obscurely, it is the .Document.Folder.Self.Path
property of the window objects returned by the .Windows()
method of the Shell.Application
COM object that contains the full, local or UNC path.
Therefore, the following lists the full paths of all open Explorer windows:
(New-Object -ComObject 'Shell.Application').Windows() | ForEach-Object {
$_.Document.Folder.Self.Path
}
Note: Special locations such as File Explorer's "Quick access" are represented by ::
-prefixed GUIDs; e.g., ::{679F85CB-0220-4080-B29B-5540CC05AAB6}
LocationName
is the property containing name of the Window, as used in the task bar. Using his answer, you can seeLocationName
with:$app.Windows() | Select-Object LocationURL, LocationName
...LocationName
works, as is, for local folders. *(Remote folders also contain the unc name in parentheses (\\ – ExsiccateLocationName
is the name of the location, which may or may not be the same as the window title; somewhat obscurely, it is the.Document.Folder.Self.Path
property that contains the location's full local or UNC path. – Dhyana