How do I get out of a >> prompt in powershell when I made a mistake?

时光毁灭记忆、已成空白 提交于 2020-07-28 12:03:21

问题


I use powershell with git for the poshgit features and sometimes I'll make an error typing the git command like git commit -m 'something and for get to close the ' before hitting enter. It goes to the new line I type ' and hit enter and I still get the >> prompt. Is there any easy way to say give me back a new prompt and get out of the infinite >> loop with out closing powershell?


回答1:


Press ctrl+C.




回答2:


@jon Z 's answer tells you how to abort it, but what you want is to hit enter at the empty >> prompt and you will be out:

PS > git commit -m 'test
>> '
>>
[temp 7b96875] test
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 c

Notice in the last >> prompt I just hit enter and it completes the command. This is done when you want the command multiline ( in this case commit message is multiline) and to signify the end, you just hit return on an empty line to get out.




回答3:


Type "exit" at the prompt. ^C didn't work for me. Nor did enter.




回答4:


If you want to come out of console without running entered command just type Ctr+C.

If you want to run entered command, but power-shell still giving that double right even after after hitting multiple enters, CHECK FOR YOUR COMMAND SYNTAX. Possibly any extra WHITE SPACE or QUOTEs might be causing this problem.




回答5:


I tried the various commands in the above answers as well. Then I simply "backspaced" and deleted all my commands back to "C:\" ! Works just fine.




回答6:


Ctr-C is the only option that worked for me in the similar situation with a >>



来源:https://stackoverflow.com/questions/8927379/how-do-i-get-out-of-a-prompt-in-powershell-when-i-made-a-mistake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!