i searching way retrieve location path (path of corresponding exe-file) of windows process using python. managed lots of information pid, name etc. no chance location.
any suggestions may me appreciated.
have checked out psutil?
pip install psutil or better...
conda install psutil it has exe method may trick
exe()[source] process executable absolute path. on systems may empty string. return value cached after first call.
>>> import psutil >>> psutil.pids() [1, 2, 3, 4, 5, 6, 7, 46, 48, 50, 51, 178, 182, 222, 223, 224, 268, 1215, 1216, 1220, 1221, 1243, 1244, 1301, 1601, 2237, 2355, 2637, 2774, 3932, 4176, 4177, 4185, 4187, 4189, 4225, 4243, 4245, 4263, 4282, 4306, 4311, 4312, 4313, 4314, 4337, 4339, 4357, 4358, 4363, 4383, 4395, 4408, 4433, 4443, 4445, 4446, 5167, 5234, 5235, 5252, 5318, 5424, 5644, 6987, 7054, 7055, 7071] >>> >>> p = psutil.process(7055) >>> p.name() 'python' >>> p.exe() '/usr/bin/python'
Comments
Post a Comment