殺進程

 

 

 

 

#1.純cmdlet命令
Get-Process -Name notepad | Stop-Process

#2.cmdlet+遍歷
Get-Process -Name notepad | foreach-object{$_.Kill()} 

#3.WMI 對象 + 遍歷 + 對象方法 
Get-WmiObject Win32_Process -Filter "name = 'notepad.exe'" | ForEach-Object{$_.Terminate()  | Out-Null }

#4.WMI 對象 + 遍歷 + cmdlet方法
Get-WmiObject Win32_Process -Filter "name = 'notepad.exe'" | Invoke-WmiMethod -Name Terminate | Out-Null


 

 

 

轉載來源:https://blog.csdn.net/HoKis/article/details/79007546/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章