3

I have been struggling to find out opening of windows explorer with particular folder location in documentation. I have tried:

import subprocess
subprocess.Popen(r'explorer /select,mypath')

All suggestions are welcome!!

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
samsap
  • 60
  • 2
  • 7

3 Answers3

6

To open specific folder in explorer:

import subprocess
subprocess.Popen('explorer "D:\your_path"')

To open explorer with specific folder selected

import subprocess
subprocess.Popen(r'explorer /select,"D:\your_path"')
Amit Bhoraniya
  • 621
  • 3
  • 14
0

You need to add the actual path to the subprocess.Popen function call. Use this

import subprocess
subprocess.Popen(r'explorer /select,"C:\path\of\folder\file"')
congusbongus
  • 13,359
  • 7
  • 71
  • 99
Sahadev
  • 1,368
  • 4
  • 18
  • 39
0

To open explorer of particular location use:

import subprocess
subprocess.Popen('explorer "C:\path\to\folder"')
Kenly
  • 24,317
  • 7
  • 44
  • 60