如何从CMD关闭Windows资源管理器 [英] How to close Windows Explorer from CMD

查看:1205
本文介绍了如何从CMD关闭Windows资源管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从CMD关闭Windows资源管理器?我有一批,做这样的:它会改变目录,打开资源管理器此文件夹中,比运行程序。用户关闭程序批应关闭资源管理器(或所有打开的探索者)后,继续下一个文件夹(CD文件夹),此文件夹中运行同一程序等。直到最后一个文件夹进行处理。

Is it possible to close Windows Explorer from CMD? I have a batch that does this: it will change directory, open explorer in this folder, than run a program. After the user closes the program the batch should close the explorer (or all explorers opened), continue on next folder (cd folder), run the same program in this folder and so on. Till the last folder is processed.

推荐答案

不从,除非你要编写打开Windows资源管理器窗口,和你自己的命令行应用程序一个批处理文件(这是关键的部分),不知何故知道该浏览器窗口的窗口句柄,因此它可以发布 WM_CLOSE 消息给它,这基本上是模仿别人的关闭窗口。

Not from a batch file unless you want to write your own command line application that opens up a windows explorer window, and (this is the key part) somehow knows the window handle of that explorer window, so it can post a WM_CLOSE message to it, which basically simulates someone closing that window.

你如何确定即开得到了所有的资源管理器窗口将是,而不是仅仅从一个命令行,你会做启动的Explorer.exe 您的实例自己的应用程序。

How you would determine "all the explorer windows that got opened" would be that instead of just starting explorer.exe instances from a command line you would do it from your own application.

我认为,在确定的窗口句柄( HWND 在Win32 API条款),并发布了密切的消息会比试图跟踪进程处理和终止explorer进程实例更好,因为这可能会导致一些副作用超越那些你想要。

I think that determining the window handle (HWND in win32 api terms) and posting a close message would be better than trying to track process handles and terminating explorer process instances, since that could cause some side effects beyond those that you'd want.

这篇关于如何从CMD关闭Windows资源管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆