This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all the running processes: | |
Get-Process | |
# List all the running processes where processname is ‘java’: | |
Get-Process | where { $_.ProcessName –eq ‘java’ } | |
# Get all the running processes where processname is ‘java’ and foreach over them calling kill on each of them: | |
Get-Process | where { $_.ProcessName –eq ‘java’ } | foreach { kill $_ } | |
# With shorthand aliases (ps is for get-process, ? Is for “where”, % is for “foreach”): | |
ps | ? { $_.ProcessName –eq ‘java’ } | % { kill $_ } |