Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve a 'Wait' mode in Powershell Get-Process

Tags:

powershell

Get-Process cmdlet returns every process that is running and then control returns to powershell. For example, running this in powershell, i get:

PS C:\Users\me> Get-Process -Name thunderbird

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   1791     139   193596     186964     551.86  13552   1 thunderbird
    723      45   194640     198084       4.81  16772   1 thunderbird
   1012      68    45068      41648       0.78  18328   1 thunderbird

 PS C:\Users\me>

Is there a way to keep it running and update when another thunderbird process starts?

like image 524
Angelos Gkaraleas Avatar asked Jun 05 '26 21:06

Angelos Gkaraleas


1 Answers

add it to the infinite loop

as following:

do{
get-process
start-sleep 5} 
while(1)
like image 144
mohamed saeed Avatar answered Jun 08 '26 00:06

mohamed saeed