在 python 中使用 shell:Programs
Use shell:Programs in python
在 windows 中,您可以使用 windows + r 并键入 shell:Programs。我正在尝试在我的 python 脚本中使用它。
我试过这样做。
import os
path = os.getenv('shell:Programs')
和
from os import path
path = os.path.expandvars('shell:Programs')
遗憾的是,这只适用于像 %appdata%
这样的标签
求助!
试试这个:
import os
os.startfile('shell:Programs')
或
import subprocess
subprocess.call("explorer")
#with file path
#subprocess.call("explorer C:\")
在 windows 中,您可以使用 windows + r 并键入 shell:Programs。我正在尝试在我的 python 脚本中使用它。
我试过这样做。
import os
path = os.getenv('shell:Programs')
和
from os import path
path = os.path.expandvars('shell:Programs')
遗憾的是,这只适用于像 %appdata%
这样的标签求助!
试试这个:
import os
os.startfile('shell:Programs')
或
import subprocess
subprocess.call("explorer")
#with file path
#subprocess.call("explorer C:\")