简体   繁体   English

关闭应用程序窗口而不终止命令行

[英]Close an application window without terminating in Command Line

Is there a command on the Windows terminal to close the window of an active application without actually killing the task/process? Windows终端上是否有一个命令可以关闭活动应用程序的窗口,而无需实际终止任务/进程?

What I'm looking for is something similar to clicking the 'X' button on the application window's name bar, or hitting Alt+F4 on it. 我正在寻找的内容类似于单击应用程序窗口名称栏上的“ X”按钮,或在其上单击Alt + F4。

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thanks! 谢谢!

I don't want the taskkill command because it terminates the process. 我不想要taskkill命令,因为它终止了进程。 I don't want it to terminate, say I want to close a Skype window so that it pops up in my Notification Tray on my Taskbar. 我不想终止它,比如说我想关闭一个Skype窗口,以便它在我的任务栏上的通知托盘中弹出。

I couldn't find a specific command on the Windows terminal to do what I wanted, but I found this VBScript code online that did the trick for me. 我无法在Windows终端上找到特定的命令来执行所需的操作,但是我发现此VBScript代码在线帮了我大忙。

set shell = createobject("wscript.shell")
shell.appactivate("Skype for Business")
shell.sendkeys "%{F4}"

This simulated an Alt+F4 keypress to Skype, which effectively closed the window and sent it to my Notification Tray. 这模拟了Skype的Alt + F4按键,该按键有效地关闭了窗口并将其发送到我的通知托盘。

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

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