본문으로 바로가기

콘솔 프롬프트에서 프로세스 종료 (taskkill)

category 시스템/Cmd 2016. 3. 14. 14:31


사용방법

1. 윈도우 키 + R 눌러서 나오는 실행창에 "cmd" 입력

2. "tasklist" 를 입력하여 프로세스 리스트 확인

C:\ > tasklist

이미지 이름                    PID 세션 이름              세션#  메모리 사용
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0         24 K
System                           4 Services                   0        368 K
smss.exe                       252 Services                   0      1,156 K
csrss.exe                      416 Services                   0      6,292 K
wininit.exe                    504 Services                   0      5,228 K
csrss.exe                      524 Console                    1     81,544 K
services.exe                   560 Services                   0     10,876 K
lsass.exe                      584 Services                   0     12,652 K
lsm.exe                        592 Services                   0      4,756 K
svchost.exe                    700 Services                   0     10,232 K
winlogon.exe                   736 Console                    1      8,412 K
svchost.exe                    836 Services                   0     11,532 K
svchost.exe                    932 Services                   0     22,600 K
svchost.exe                    972 Services                   0     21,196 K
svchost.exe                   1004 Services                   0     17,028 K
svchost.exe                    228 Services                   0     42,044 K
stacsv64.exe                   436 Services                   0      8,076 K
svchost.exe                   1084 Services                   0      7,456 K
svchost.exe                   1260 Services                   0     17,692 K
wlanext.exe                   1500 Services                   0      6,208 K
conhost.exe                   1508 Services                   0      3,096 K
spoolsv.exe                   1628 Services                   0     13,480 K
sched.exe                     1660 Services                   0      7,640 K
svchost.exe                   1680 Services                   0     19,140 K
AESTSr64.exe                  1832 Services                   0      3,044 K
avguard.exe                   1860 Services                   0     25,872 K
Ath_CoexAgent.exe             1884 Services                   0      6,096 K
AdminService.exe              1944 Services                   0      5,504 K
svchost.exe                   2004 Services                   0     11,544 K
HPDrvMntSvc.exe               2044 Services                   0      3,692 K
HPHotkeyMonitor.exe           1148 Services                   0      8,024 K
KMS-R@1n.exe                  1340 Services                   0      4,404 K
NLSvc.exe                     1704 Services                   0     43,908 K
svchost.exe                   2060 Services                   0      8,312 K
TeamViewer_Service.exe        2092 Services                   0     14,588 K
vmnat.exe                     2148 Services                   0      4,904 K
vmware-authd.exe              2188 Services                   0     10,068 K
unsecapp.exe                  2252 Services                   0      5,408 K
vmnetdhcp.exe                 2280 Services                   0      4,288 K
vmware-usbarbitrator64.ex     2308 Services                   0      8,212 K
WmiPrvSE.exe                  2364 Services                   0     19,328 K
WmiPrvSE.exe                  2492 Services                   0     14,696 K
taskhost.exe                  2832 Console                    1     15,784 K
dwm.exe                       2920 Console                    1    109,560 K
explorer.exe                  2960 Console                    1    114,028 K
hkcmd.exe                     3080 Console                    1      7,140 K
igfxpers.exe                  3088 Console                    1      8,060 K
SynTPEnh.exe                  3104 Console                    1     16,860 K
sttray64.exe                  3116 Console                    1     18,956 K
TPFanControl.exe              3144 Console                    1      8,600 K
NLClientApp.exe               3216 Console                    1     80,296 K
nusb3mon.exe                  3440 Console                    1      5,780 K
Dropbox.exe                   3488 Console                    1    190,820 K
QLBController.exe             3532 Console                    1     47,916 K
avgnt.exe                     3740 Console                    1      4,460 K
avshadow.exe                  3760 Services                   0      4,284 K
hpqWmiEx.exe                  3920 Services                   0      9,604 K
SearchIndexer.exe             3156 Services                   0     30,820 K
svchost.exe                   4088 Services                   0      6,436 K
WmiPrvSE.exe                  4784 Services                   0      8,892 K
KMS-R@1nhook.exe              4836 Services                   0      1,904 K
sppsvc.exe                    3712 Services                   0     17,472 K
KMS-R@1nhook.exe              4584 Services                   0      1,788 K
OSPPSVC.EXE                   3180 Services                   0     16,364 K
SynTPHelper.exe               5416 Console                    1      3,872 K
cmd.exe                       2292 Console                    1      3,620 K
conhost.exe                   5756 Console                    1      8,684 K
chrome.exe                    4404 Console                    1    155,920 K
chrome.exe                    4560 Console                    1    139,656 K
chrome.exe                    2400 Console                    1     58,152 K
chrome.exe                    3652 Console                    1     29,004 K
chrome.exe                    6136 Console                    1    107,896 K
chrome.exe                    5824 Console                    1    133,896 K
chrome.exe                    5668 Console                    1     67,512 K
chrome.exe                    4520 Console                    1     74,084 K
chrome.exe                    1348 Console                    1    203,952 K
chrome.exe                    5680 Console                    1     47,984 K
chrome.exe                    5340 Console                    1     58,052 K
chrome.exe                    3596 Console                    1     51,372 K
mmc.exe                       1984 Console                    1     39,572 K
chrome.exe                    1248 Console                    1     71,048 K
chrome.exe                    2348 Console                    1     58,860 K
chrome.exe                    3704 Console                    1     81,956 K
chrome.exe                    4416 Console                    1     77,576 K
chrome.exe                    1540 Console                    1     94,916 K
chrome.exe                    1748 Console                    1     63,328 K
chrome.exe                    1592 Console                    1    130,968 K
chrome.exe                     696 Console                    1    120,904 K
chrome.exe                    3312 Console                    1     56,468 K
chrome.exe                    3176 Console                    1    118,128 K
taskeng.exe                   5780 Services                   0      6,144 K
chrome.exe                    2332 Console                    1    121,508 K
chrome.exe                    6376 Console                    1     58,568 K
chrome.exe                    5012 Console                    1    167,216 K
chrome.exe                    5372 Console                    1    119,240 K
chrome.exe                    7064 Console                    1     67,136 K
editplus.exe                  6804 Console                    1     12,836 K
chrome.exe                    2604 Console                    1    107,992 K
chrome.exe                    3848 Console                    1    179,052 K
chrome.exe                    2408 Console                    1     58,488 K
chrome.exe                    6652 Console                    1    112,292 K
cmd.exe                       6720 Console                    1      3,464 K
conhost.exe                   7136 Console                    1      8,532 K
notepad.exe                   5424 Console                    1      8,836 K
chrome.exe                    5020 Console                    1     35,992 K
tasklist.exe                  7028 Console                    1      6,024 K
WMIC.exe                      5828 Services                   0      7,228 K
WMIC.exe                      3884 Services                   0      7,968 K
conhost.exe                   4920 Services                   0      3,336 K
conhost.exe                   7044 Services                   0      3,344 K

3. taskkill /? 입력하여 사용법 확인

C:\ > taskkill /?

TASKKILL [/S 시스템 [/U 사용자 이름 [/P [암호]]]]
         { [/FI 필터] [/PID 프로세스 id | /IM 이미지 이름] } [/T] [/F]

설명:
    이 도구는 프로세스 ID(PID) 또는 이미지 이름으로 작업을 종료하는 데
    사용합니다.

매개 변수 목록:
    /S    시스템           연결할 원격 시스템을 지정합니다.

    /U    [도메인\]사용자  명령을 실행해야 하는 사용자 컨텍스트를
                           지정합니다.

    /P    [암호]           해당 사용자 컨텍스트의 암호를 지정합니다.
                           생략한 경우에는 물어봅니다.

    /FI   필터             작업 집합을 선택하는 필터를 적용합니다.
                           "*"를 사용할 수 있습니다. 예: imagename eq acme*

    /PID  프로세스_ID      종료할 프로세스의 PID를 지정합니다.
                           TaskList를 사용하여 PID를 얻을 수 있습니다.

    /IM   이미지 이름      종료할 프로세스의 이미지 이름을
                           지정합니다. 와일드카드 문자 '*'를 사용하여
                           모든 작업 또는 이미지 이름을 지정할 수 있습니다.

    /T                     지정된 프로세스와 그 프로세스로부터 시작된
                           모든 자식 프로세스를 종료합니다.

    /F                     프로세스를 강제로 종료하도록 지정합니다.

    /?                     이 도움말 메시지를 표시합니다.

필터:
    필터 이름     유효한 연산자             유효한 값
    -----------   ---------------           -------------------------
    STATUS        eq, ne                    RUNNING |
                                            NOT RESPONDING | UNKNOWN
    IMAGENAME     eq, ne                    이미지 이름
    PID           eq, ne, gt, lt, ge, le    PID 값
    SESSION       eq, ne, gt, lt, ge, le    세션 번호.
    CPUTIME       eq, ne, gt, lt, ge, le    CPU 시간 형식
                                            hh:mm:ss
                                            hh - 시간,
                                            mm - 분, ss - 초
    MEMUSAGE      eq, ne, gt, lt, ge, le    메모리 사용(KB)
    USERNAME      eq, ne                    사용자 이름([domain\]user
                                            형식)
    MODULES       eq, ne                    DLL 이름
    SERVICES      eq, ne                    서비스 이름
    WINDOWTITLE   eq, ne                    창 제목

    참고
    ----
    1) /IM 스위치에 대한 와일드카드 문자 '*'는 필터가 적용될 때만
    사용할 수 있습니다.
    2) 원격 프로세스는 항상 강제적으로(/F) 종료될 수 있습니다.
    3) 원격 컴퓨터가 지정되면 "WINDOWTITLE"  및 "STATUS" 필터는 
       지원되지 않습니다.

예:
    TASKKILL /IM notepad.exe
    TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
    TASKKILL /F /IM cmd.exe /T 
    TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
    TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
    TASKKILL /S 시스템 /U domain\username /FI "USERNAME ne NT*" /IM *
    TASKKILL /S 시스템 /U 사용자 이름 /P 암호 /FI "IMAGENAME eq note*"


4. taskkill 로 메모장을 종료시켜보자

C:\ > taskkill /f /im "notepad.exe"
성공: 프로세스 "notepad.exe"(PID 5424)이(가) 종료되었습니다.
성공: 프로세스 "notepad.exe"(PID 908)이(가) 종료되었습니다.
참고링크 https://technet.microsoft.com/en-us/library/bb491009.aspx