如何在PowerShell中结束多行命令 [英] How to end a multi-line command in PowerShell
问题描述
这应该很简单,但无法弄清楚.如何在PowerShell中结束多行命令?例如,如果我输入Get-ChildItem |
并按Enter,那么我会得到一个>>
提示,我认为是继续执行该命令.但是,如果我随后输入foreach{Write-Host $_.name}
并按Enter,则仍然会显示>>
提示.
This should be easy, but can't figure it out. How do I end a multi-line command in PowerShell? For example if I enter Get-ChildItem |
and press enter then I get a >>
prompt which I assume is to continue the command. But if I then enter foreach{Write-Host $_.name}
and press enter I still get the >>
prompt.
我怎么说,我完成了,现在运行此程序?我以为会在我编写完整的命令(不以管道或未闭合的括号结尾)时发生,但似乎没有.还尝试以分号结尾,但这并没有太大帮助.
How do I say, I'm done, run this now? I thought it would happen when I wrote a complete command (not ending with a pipe or an unclosed bracket), but doesn't seem to. Also tried ending with a semi-colon, but that didn't help much.
推荐答案
在我问完之后,我就知道了...击中 Enter 两次使其实现了:)
And right after I asked, I figured it out... Hitting Enter twice made it happen :)
这篇关于如何在PowerShell中结束多行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!