0

I have to find full path of some .exe files in python. I've tried the following but this always outputs C:\Users\Admin\.

os.path.abspath("file.exe")
  • where are you "some .exe" files located and where are you running your python script. plz be more specific in this matter – xxbinxx Jun 13 '20 at 16:14
  • I have to find path of a file with location - C:\Windows\System32\svchost.exe using a python code. I used os.path.abspath("svchost.exe") but it's not giving a correct output. – Paridhi Sharma Jun 13 '20 at 16:48
  • it won't give you correct output because svchost is not in your current working path. why do you want `svchost` ? – xxbinxx Jun 13 '20 at 16:49
  • I want it's path for finding the file antivirus information through virustotal. – Paridhi Sharma Jun 13 '20 at 16:52
  • please join this [chat room](https://chat.stackoverflow.com/rooms/215897/svchost-issue) – xxbinxx Jun 13 '20 at 16:54
  • Unable to chat. It says must have 20 reputation. – Paridhi Sharma Jun 13 '20 at 17:00
  • Okay. so what's the approach you're following. We would want to know the overall picture so we know how you reached the `svchost` conclusion – xxbinxx Jun 13 '20 at 17:19
  • FYI I think you'll have to use some windows specific python packages like `wmi` or `win32com` etc depending upon your python version. With that you can check the executor of your process. `svchost` in windows is responsible for execution so you'll get the path of the process executor. You'll need to run the script with admin privileges as `svchost` information is not accessible to all. – xxbinxx Jun 13 '20 at 17:38

1 Answers1

0

Specifications please. Where is your python script running from and it location for better understanding.

Abu
  • 1
  • 1