Search code examples
pythonpython-3.xpathpython-os

Use shell:Programs in python


In windows you can use windows + r and type shell:Programs. Im trying to use this in my python script.

I have tryed doing this.

import os
path = os.getenv('shell:Programs')

and

from os import path
path = os.path.expandvars('shell:Programs')

This sadly only works for tags like %appdata%

Help!


Solution

  • Try this:

    import os
    os.startfile('shell:Programs')
    

    OR

    import subprocess
    subprocess.call("explorer")
    #with file path    
    #subprocess.call("explorer C:\\")