Powershell 如何从输入命令(相当于 UNIX 的 ctrl+C)得到 abort/exit?

Powershell how to abort/exit from the input command (ctrl+C UNIX equivalent)?

这是一个非常基本的问题,但我无法在 Internet 或 Whosebug 上找到答案。

问题描述及示例:

在 PowerShell 控制台中输入 'cd..' 会带我进入一个新行,这个“~>”正在等待更多输入,我无法再次退出。

如何中止此命令?我想回到'~\Documents>'。在 UNIX bash 我会按 ctrl+c.

PowerShell 中的 Ctrl+c 相当于什么?

示例 PowerShell 控制台:

~\Documents> cd..
~>
~> ^X$
$ : The term '$' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ $
+ ~~
    + CategoryInfo          : ObjectNotFound: ($:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我尝试了 exit、Ctrl+c、Ctrl+X、Ctrl+Shift+c 和许多其他... =(

How can I abort this command?

也是ctrl-c在powershell中中止

看起来你实际上并没有卡在行继续中,它似乎实际上是在向上移动一个文件夹。当它显示 ~> 时,您是否尝试 运行 任何正常命令?

正如Mathias所说,~可以用来表示$home