Reputation: 63
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))
Upvotes: 1
Views: 1238
Reputation: 45806
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", ","])
Upvotes: 2