I should get the number of active processes and active threads running in my server or computer using command-line.. I don't want to list all the processes or threads running, I need them in numbers.
Asked
Active
Viewed 1.9k times
2 Answers
7
Using PowerShell, the following two commands will get that information:
Number of processes running:
(Get-Process).Count
Number of threads running:
(Get-Process|Select-Object -ExpandProperty Threads).Count
harrymc
- 455,459
- 31
- 526
- 924
-
The command works perfectly on powershell but it doesn't work in cmd..Is there any specific command for cmd? – Vinodh Gowda Mar 24 '19 at 12:08
-
1Run it in CMD as : `powershell "(Get-Process|Select-Object -ExpandProperty Threads).Count"`. – harrymc Mar 24 '19 at 12:21
1
You could use PowerShell for this.
To get a list of all active processes on the local computer, use this command.
Get-Process | Measure
You can also filter these results. For example, see the below code.
Get-Process winword, explorer | Measure
To get no of threads, run this command.
Get-Process | Select-Object -ExpandProperty Threads | Measure
To use these command in Command prompt, simply do this.
PowerShell -Command "Get-Process | Measure"
PowerShell -Command "Get-Process | Select-Object -ExpandProperty Threads | Measure"
PowerShell -Command "Get-Process | Select-Object -ExpandProperty Threads | Measure"
Resources
- Get-Process
- Measure-Object
- Select-Object
DxTx
- 1,086
- 8
- 23


