Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open explorer on a file

In Python, how do I jump to a file in the Windows Explorer? I found a solution for jumping to folders:

import subprocess subprocess.Popen('explorer "C:\path\of\folder"') 

but I have no solution for files.

like image 526
Kirill Titov Avatar asked Nov 11 '08 19:11

Kirill Titov


1 Answers

From Geoff Chappell's The Windows Explorer Command Line

import subprocess subprocess.Popen(r'explorer /select,"C:\path\of\folder\file"') 
like image 140
Blair Conrad Avatar answered Oct 13 '22 04:10

Blair Conrad