我已经尝试了很多主题变体来在 P:\驱动器上打开这个资源管理器窗口,根据我的知识告诉我,文件夹的路径在除 C:\驱动器之外的任何地方意味着它失败(它适用于 C:) 所以也许路径是错误的?下面的代码显示了我所做的一些尝试,但仍然没有成功,“P:”在所有机器上的映射相同。
def Open_Win_Explorer_and_Select_Dir():
import subprocess
fldrname = os.path.basename(currentproject.get())
print(fldrname)
#subprocess.Popen('c:\windows\EXPLORER.EXE', cwd=(P:/Projects 2013/)
#subbprocess.Popen('c:\\windows\\EXPLORER.EXE' cwd=('P:\\Projects_2013\\')fldrname)
#subprocess.Popen(r'C:/Windows/explorer.exe', cwd=r'//WRDBSVR/Project_Data/Projects_2013/'+fldrname)
subprocess.Popen('explorer /n, /select r"\\192.168.0.27\\Project_Data\\Projects_2013\\"'+fldrname)
#subprocess.Popen('explorer /n, /select r"P:\\Project_Data\\Projects_2013\\"'+fldrname)
最佳答案
打开我的电脑(对于 windows)试试:
import subprocess
subprocess.Popen('explorer ""')
"#if subprocess.Popen('explorer "{0}".format(full_path)') is struck at pc\my documents.
where full_path=os.path.join("your/path")"
关于python - 在 Python 中的特定网络位置打开 Windows 资源管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20190175/