Set Arg = WScript.Arguments
set WshShell = createObject("Wscript.Shell")
Set Inp = WScript.Stdin
Set Outp = Wscript.Stdout
Set objShell = CreateObject("Shell.Application")
Set AllWindows = objShell.Windows
For Each window in AllWindows
outp.writeline window.locationname
Next
to use
cscript /nologo c:\pathtoscript\script.vbs
Note it does Explorer and Internet Explorer windows for historical reasons - they used to be the same program.
Which gives output like this
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\David Candy>cscript /nologo "C:\Users\David Candy\Documents\Assorted\Sc
ripts\ListOpenShellWindowsStdOut.vbs"
Newest 'batch-file' Questions - Stack Overflow
dos command or batch file to get the path for the current active folder opened o
n my screen - Stack Overflow
Music
Favorites
To get into a batch variable use a for loop
for /f "delims=" %%A in ('cscript // nologo script.vbs') do Echo %%A