Thyoity
Thyoity

Reputation: 191

How to count amount of processes using Batch file (.bat)

For example, I want to count the amount of processes with the name "chrome.exe". How can I do that using batch file and show it using ECHO?

Upvotes: 1

Views: 4399

Answers (3)

user1512312
user1512312

Reputation: 1

I am getting the output like

No Process exists for my id number of chromes: 0 Press any key to continue

But if i check the task manager, there are lot of chrome.exe processes running.

Upvotes: 0

npocmaka
npocmaka

Reputation: 57272

@echo off

for /f "tokens=1 delims=" %%# in ('qprocess^|find /i /c /n "chrome"') do (
    set number=%%#
)

echo number of chromes: %number%
pause

Upvotes: 4

ths
ths

Reputation: 2942

tasklist|find /i /c "chrome.exe"

Upvotes: 3

Related Questions