我正在执行 powershell 命令,如:powershell.exe“Get-Process java | Stop-Process”,当命令完成时,它要求我按 Enter 键然后返回到控制台。
有没有一种方法可以执行命令,这样我就不必按回车键即可返回到控制台?
答案1
您是否收到了如下确认信息:
Confirm
Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "java (xxxx)".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
一般来说,你可以用这个来抑制确认:
Get-Process java | Stop-Process -Confirm:$false