Redirecting existing Windows Explorer instance
I have a program that opens a lot of folders right now, and I am hoping that I can use the already open explorer instances to open new ones. I have this code:
import subproce开发者_开发技巧ss
subprocess.Popen(r'explorer /select,"C:\path\of\folder\file"')
I have seen threads on doing this in C#. Does anyone know a way it can be done in Python?
Thanks,
BenI do not believe you can do this. If there is any hope you will probably need to look at Python for .Net, you might give IronPython a try. But the code above using subprocess is simply giving you the same result as if you ran that string in command line. Which launches the explorer application with those arguments. But once its started, its off running on its own. Its not looking for command line input any more. I've looked at the list of command line arguments for explorer, and I see nothing that would indicate you can manipulate it once its running. Sorry, hope this helps.
精彩评论