# view running processes
Get-Process 'mmc' | select id,name,MainWindowTitle
Id Name MainWindowTitle
-- ---- ---------------
18452 mmc Services
24828 mmc Disk Management
# close only the services app
Get-Process 'mmc' | Where MainWindowTitle -eq 'Services' | Stop-Process
# verify other mmc processes did not stop:
Get-Process 'mmc' | select id,name,MainWindowTitle
Id Name MainWindowTitle
-- ---- ---------------
24828 mmc Disk Management
2条答案
按热度按时间sdnqo3pr1#
进程对象有一个窗口标题属性,您可以使用。请尝试以下操作:
t40tm48m2#
我已经使用了这个命令,它的工作: