It's easy to fall into the habit of using multiple Notepad windows for various note-taking and reading needs. The convenience of having separate windows for different types of information can be surprisingly addictive.
At the end of the day, you might have quite a few notepad and closing them one by one is not practical or ideal.
Scripting or using PowerShell comes in handy in such scenario.
Example of a PowerShell code snippet to kill all running notepad on the system.
Get-Process -Name "*notepad*" | Stop-Process
Above code snippet, get all notepad processes and is pipe to stop-process that will close the notepad.
To just list the process of all running processes on the system, run this PowerShell code snippet.
Get-WmiObject -Class Win32_Process | select "ProcessName", "ProcessID"
To kill or close the process using a PID, run the command beloww:
Stop-Process -Id 4365 -Force
Or use -whatif parameter to see what will happen.
Example:
stop-process -id 10432 -whatif Sample Output, it shows that 10432 is powershell_ise and it will be stop or close when -whatif parameter is omitted.
What if: Performing the operation "Stop-Process" on target "powershell_ise (10432)".
Man proposes but God disposes. Trust God for His plans, for it is way much better than your plans.
At the end of the day, you might have quite a few notepad and closing them one by one is not practical or ideal.
Scripting or using PowerShell comes in handy in such scenario.
Example of a PowerShell code snippet to kill all running notepad on the system.
Get-Process -Name "*notepad*" | Stop-Process
Above code snippet, get all notepad processes and is pipe to stop-process that will close the notepad.
To just list the process of all running processes on the system, run this PowerShell code snippet.
Get-WmiObject -Class Win32_Process | select "ProcessName", "ProcessID"
To kill or close the process using a PID, run the command beloww:
Stop-Process -Id 4365 -Force
Or use -whatif parameter to see what will happen.
Example:
stop-process -id 10432 -whatif Sample Output, it shows that 10432 is powershell_ise and it will be stop or close when -whatif parameter is omitted.
What if: Performing the operation "Stop-Process" on target "powershell_ise (10432)".
Man proposes but God disposes. Trust God for His plans, for it is way much better than your plans.
Comments
Post a Comment