简体   繁体   中英

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?

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.

Any help would be greatly appreciated. Thanks!

I don't want the taskkill command because it terminates the process. 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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