- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of Passthru parameter in Stop-Process in PowerShell?
With the Passthru parameter, PowerShell returns the output in the console. For example, below notepad.exe process with ID 12344 will be stopped and the same will be displayed in the console with the Passthru parameter. Earlier it was not the case with only Stop-Process.
PS C:\WINDOWS\system32> Stop-Process -Id 12344 -PassThru Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 227 13 2800 13440 0.19 12344 1 notepad
You can also combine –Confirm and –PassThru parameters.
PS C:\WINDOWS\system32> Stop-Process -Id 26492 -Confirm -PassThru Confirm Are you sure you want to perform this action? Performing the operation "Stop-Process" on target "notepad (26492)". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 228 14 3152 13736 0.20 26492 1 notepad
- Related Articles
- What is the use of -Force parameter in Get-ChildItem in PowerShell?
- What is the use of Get-Process command in PowerShell?
- How to stop all instances of the process in PowerShell?
- How to stop the specific instance of the process in PowerShell?
- How to use the ErrorAction parameter in PowerShell?
- How to use an alias() for the parameter in PowerShell?
- How to check if a process is exited from the system after executing Stop-Process command in PowerShell?
- How to use the -recursive parameter in Get-ChildItem using PowerShell?
- How to use Wait-Process in Powershell?
- How to use –Wait parameter in Restart-Computer cmdlet in PowerShell?
- How to use -For parameter in Restart-Computer cmdlet in PowerShell?
- How to use –Timeout parameter in Restart-Computer cmdlet in PowerShell?
- What is the use of $ErrorView in PowerShell?
- What is use of $error variable in PowerShell?
- What is the use of $Lastexitcode and $? Variable in PowerShell?

Advertisements