How can I open Windows Explorer at 'This PC', using python 3.6 when using Windows 10? I am not sure what the path is to 'This PC'. (Previously 'My Computer'). I am able to open Windows Explorer to known paths using:
import os
os.startfile(os.path.realpath(DIRECTORY_PATH))
So, I played around, and there is no simple path I can find that leads to "This PC".
I found this page though that goes over the arguments you can give to explorer.exe
, and saw ,
:
import subprocess
subprocess.run(["explorer", ","])
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.