How to treat the "No instance found" of WMIC command in batch?

خرید بک لینک

In a batch I want to terminate all instance of a process. I've try using:

@echo off
setlocal EnableDelayedExpansion
for /f "usebackq skip=1" %%r in (`wmic process where Name^="CALC.exe"  get Processid ^| findstr /r /v "^$"`) do SET procid=%%~r
IF [!procid!] NEQ [] (
  wmic process where Name="CALC.exe" call terminate >> NUL
) ELSE (
  GOTO :break
)
:break
SET procid=
endlocal

But if no instance of calc.exe is existing I don't want to have the "No instance(s) available" being displayed. Also I will prefer to not have the display scrolling down one line per instance of calc.exe

How to do that ??

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 176 تاريخ: سه شنبه 11 خرداد 1395 ساعت: 16:19

صفحه بندی