如何获取哪个进程正在使用该目录?
How to get which process is using the directory?
我想删除 os win10
目录 d:\tmpdata
中的所有文件。
import shutil
shutil.rmtree('d:\tmpdata')
遇到如下问题:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'd:\tmpdata'
尝试获取正在使用资源的进程--directroy d:\tmpdata
:
tasklist | findstr 'tmpdata'
或
tasklist #run it only ,search by eye.
没有找到进程,如何获取哪个进程正在使用该目录?
尝试built-in 软件资源监视器。搜索 resmon.exe。启动程序,select CPU 然后关联句柄 - 输入您的文件夹路径并查看它的用途。
我想删除 os win10
目录 d:\tmpdata
中的所有文件。
import shutil
shutil.rmtree('d:\tmpdata')
遇到如下问题:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'd:\tmpdata'
尝试获取正在使用资源的进程--directroy d:\tmpdata
:
tasklist | findstr 'tmpdata'
或
tasklist #run it only ,search by eye.
没有找到进程,如何获取哪个进程正在使用该目录?
尝试built-in 软件资源监视器。搜索 resmon.exe。启动程序,select CPU 然后关联句柄 - 输入您的文件夹路径并查看它的用途。