1

Currently trying to write a batch file that checks to see if certain browser window titles are open and to open them if not. The issue is that it seems it only detects the most recent browser window I interacted with. If I have "Pandora" and "Facebook" open and last interacted with "Facebook", it returns an "Unknown" window title for "Pandora". It happens in all browsers I've tested this with... Is there any way to circumvent this? I'm open to batch / vbscript / powershell solutions so long as they can be called from a batch file.

tasklist /fi "windowtitle eq Facebook - Google Chrome" 2>NUL | find /i /n "chrome.exe">NUL
if "%ERRORLEVEL%"=="0" (
     echo Facebook is Open
) else (
     echo Starting Facebook
     start C:\Progra~2\Google\Chrome\Application\chrome.exe --new-window http://facebook.com
)
RADRaze2KX
  • 23
  • 5
  • See [this comment](http://stackoverflow.com/questions/25928894/enumerate-open-google-chrome-windows-tabs-in-delphi#comment40590473_25928894) by @bummi – JosefZ Mar 27 '16 at 20:03

1 Answers1

0
Set objShell = CreateObject("Shell.Application")
Set AllWindows = objShell.Windows
For Each window in AllWindows
    msgbox window.locationname
Next

list open shell windows (folders and web sites for historical reasons).