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 ??
برچسب:
نویسنده: استخدام کار