-2

I would like to close all chrome windows (not tabs - just to be clear) except the first opened and i think that could happen with powershell script. I tried with CMD but it's a nightmare. This topic is very similar, but i can't adapt it for my case.

Paxz
  • 2,959
  • 1
  • 20
  • 34
  • 3
    Yeah that could happen with a powershell script. Please show what you tried so far and where it failed :) Take a look at [ask] and offer a [mcve]. We are not here to do all the work for you ;) – Paxz Aug 06 '18 at 14:53
  • The thing is that i cannot start. I think that the first step should be to get a list of all active windows. And here is where i am failing :( – Doland_Soze Aug 06 '18 at 15:15

1 Answers1

0

Take a closer look at the Get-Process
You can display all properties, if you pipe the CMDLet with select: Get-Process | select *
There are many usefull properties you can use for your project, like ProcessName, StartTime,TotalProcessorTime, MainWindowTitle etc.

Heres an example howe you get all open chrome windows

Get-Process | Where-Object {$_.ProcessName -eq "chrome" -and $_.MainWindowTitle -ne ""}
Evilcat
  • 388
  • 3
  • 9