简体   繁体   中英

How can I kill all processes that were started with my user account using a BAT file?

I am creating a "self-destruct" script that will delete my user folder when someone tries to illicitly access my files. I do not have administrator rights, but I do have permission to remove my own user folder. Windows won't let me delete it if a process is accessing a file for obvious reasons, so what I want to try and do is quit all the processes running under my username so that I can delete the folder with no worries. Is there a way to do this with TASKKILL.exe?

This should forcefully kill any task of user MyUser :

taskkill /f /fi "USERNAME eq MyUser"

References:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM