Kill the process and delete the batch BAT code for the source file _dos/bat

Source: Internet
Author: User
When you double-click Run, enter the name of the process

Batch code:
Copy Code code as follows:

@ echo off
Color 6e
del 1.txt
del ildd.txt
TASKLIST &G T;>ildd.txt
title kills the process and deletes the source file--by:qp
CLS
Echo.
Echo Current process:
for/f "Skip=3"%%i in (' findstr. * "Ildd.txt") do echo%%i
Echo. Enter the name of the process to end and remove
Echo: 1.exe Ping.exe rar.exe
set/p command= Input:
WMIC process get executablepath,handle|find/i "%command%" >> 1.txt
CLS
for/l%%d in (1 1 4) do echo.
echo the process you entered is:%command%
for/f "Tokens=1 delims=."%%i in (' Type 1.txt ') do (
Echo found path with:%%i.exe & Set "Path =%%i"
)
Echo.
Echo presses any key to end the process and delete the file
Pause>nul
Echo.
Echo Resolute to delete press any key ...
for/l%%d in (1 1 4) do echo.
Pause>nul
taskkill/f/im%command%
del/f "% path%.exe"
if not exist "% path%.exe" Echo succeeded: File deleted ...
del 1.txt
del ildd.txt
Echo Press any key to end this program
Pause>nul

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.