PowerShell 中 Stop-Process 中 Passthru 引數的用途是什麼?
使用 Passthru 引數,PowerShell 會返回控制檯中的輸出。例如,ID 為 12344 的 notepad.exe 程序停止後,就會使用 Passthru 引數在控制檯中顯示。以前僅使用 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
還可結合使用 –Confirm 和 –PassThru 引數。
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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP