简体   繁体   English

在 windows 资源管理器中“双击”或输入所选文件

[英]"Double Clicking" or Enter on selected file in windows explorer

I'm trying to simulate "double click" or enter on a selected file in windows explorer (win10pro) after I've run this code:运行此代码后,我正在尝试模拟“双击”或在 windows 资源管理器 (win10pro) 中输入选定文件:

import subprocess
os.chdir("C:/Users/***/***/DeforumStableDiffusionLocal")
subprocess.Popen(r'explorer /select, "C:\Users\***\***\DeforumStableDiffusionLocal\run_still.bat')

I've tried importing the keyboard module but I'm a little confused as to how it would interact with the opened explorer window.我试过导入键盘模块,但我有点困惑它如何与打开的资源管理器 window 交互。
Normally i would run within python, but I'm trying to streamline with another program where I'm getting weird SSL errors from within the program, but when run in windows explorer it works fine.通常我会在 python 内运行,但我正在尝试使用另一个程序进行简化,我在程序中遇到奇怪的 SSL 错误,但是在 windows 资源管理器中运行时它工作正常。 Thanks in advance!提前致谢!

In native Windows you would use ShellExecute .在本机 Windows 中,您将使用ShellExecute In Python you should use os.startfile(myfilepath) .在 Python 你应该使用os.startfile(myfilepath)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM