Released files, directories possession, easily delete files

When the file, directory or file is opened some programs, then later you want to delete a file or directory, and can not be deleted, with this script you can easily remove.

  1. Download Handle.zip file https://docs.microsoft.com/zh-cn/sysinternals/downloads/handle
    extract to any place

  2. bat batch

    OFF @echo
    REM handle executable file
    the SET "handle = C: \ the Users \ TOO \ Desktop \ the Handle \ Handle.exe"
    REM files to be deleted
    SET "appfile = C: \ Users \ too \ Desktop \ test"

    FOR /F "tokens=3" %%a IN ('%handle% -nobanner %appfile% ^| FINDSTR /V explorer.exe') DO (
    @echo %%a
    @taskkill /F /PID %%a
    )

NOTE: After the lifting of possession can easily delete the file.

Guess you like

Origin blog.51cto.com/vtime/2421587