[英]How to make PowerShell wait till output of the command is shown?
如何让 powershell 在执行第三条命令之前显示第二条命令的 output?
Write-Host 'List of disks:'
Get-PhysicalDisk
$number = Read-Host -Prompt 'Please choose number from disks above:'
将 output 显式传送到Out-*
或Format-*
命令通常会导致 PowerShell 同步完成输出:
Write-Host 'List of disks:'
Get-PhysicalDisk |Out-Default # or `...|Format-Table`
$number = Read-Host -Prompt 'Please choose number from disks above:'
您可以在计算机批处理文件中使用pause命令。 它允许计算机暂停当前运行的批处理文件,直到用户按下任意键。
因此,在第二个命令之后,在下一行使用pause ,然后在脚本中输入第三个命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.