Gri*_*han 11 c python windows filesystems windows-api-code-pack
如何在窗口中通过某个进程(PID)打印文件名?或者所有进程(PID)当前打开一个文件.
Process Explorer是一个实用工具.但它怎么没有提到呢?Windows中存在的
任何/ proc文件系统类型的东西?
Can we read any Window's Registry?
I wants to write a programming code And I rarely work on windows.
Run Code Online (Sandbox Code Playgroud)
在Python中有两个解决方案:
1.import psutil
2. import win32api,win32con,win32process
但这对我来说仍然是一个问题!
1.这些图书馆如何运作?
2.任何寄存器,内存或虚拟文件系统都会保留此信息吗?
如果它可能在窗口中,为什么TasK-Manager中不存在此信息?
Rah*_*tam 23
这是python中独立于平台的解决方案.
import psutil
p = psutil.Process(os.getpid()) # or PID of process
p.open_files()
Run Code Online (Sandbox Code Playgroud)
所以我推荐你psutil包它有太好的功能来获取有关正在运行的进程的信息