0

I know Windows equivalent of "ps aux" is tasklist which works well on my win10

enter image description here

per What is the Windows equivalent of "wc -l"? Windows equivalent of wc -l is find /c /v "".

When I tried combine them together, I got

FIND: Parameter format not correct

enter image description here

how do I use powershell to get the number of processes running on win10?

JJJohn
  • 425
  • 1
  • 10
  • 25
  • 1
    tasklist is not a powershell native applet, so to work with its output you need to parse text (just like you do with Linux), but that is not the preferred way to use an object oriented shell like powershell. the native verb get-process lets you do all kinds of without parsing strings, like getting the number of processes. – Frank Thomas Mar 12 '22 at 06:57
  • This command would likely have worked in Command Prompt. PowerShell unfortunately is very different (not in a good way). – Daniel B Mar 12 '22 at 09:27
  • 2
    Does this answer your question? [How to get number of active processes and threads running using command-line?](https://superuser.com/questions/1416905/how-to-get-number-of-active-processes-and-threads-running-using-command-line) – harrymc Mar 12 '22 at 10:26
  • 1
    @DanielB not in a good way. In a great way. – Appleoddity Mar 12 '22 at 16:06

2 Answers2

2

(Get-Process).Count

and, as a bonus:

(Get-Process|Select-Object -ExpandProperty Threads).Count

Run it in CMD (as an administrator) as : powershell "(Get-Process|Select-Object -ExpandProperty Threads).Count"

Example output: enter image description here

Credit: harrymc

More info over at https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-process?view=powershell-7.2

Gantendo
  • 4,615
  • 1
  • 18
  • 30
0

tasklist | Measure-Object -l

and I still got my pipe, so I feel good ;)

Isaldor
  • 1
  • 1