在 Windows 命令提示符下运行上次执行的命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3177971/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:45:42  来源:igfitidea点击:

Run the last executed command in Windows command prompt

windowscmd

提问by Vijay

When using UNIX I use to type !!to run the last executed command.

使用 UNIX 时,我使用键入!!来运行上次执行的命令。

How could I do the similar kind of operation on Windows command prompt?

我怎么能在 Windows 命令提示符下做类似的操作?

回答by Paolo

followed by Enter

其次是 Enter

回答by FrVaBe

You can also use F7 to navigate the command history. F1 will recover the last command character by character.

您还可以使用 F7 来浏览命令历史记录。F1 将逐字符恢复最后一个命令。

回答by ROMANIA_engineer

Windows PowerShell

Windows PowerShell

  • ihy
  • Invoke-History
  • ihy
  • Invoke-History

Sometimes(if you didn't press F9& didn't choose an older command and if you didn't navigate through history using the keys F5/ F7), the following keys can work in cmd:

有时(如果您没有按下F9& 没有选择旧命令,并且如果您没有使用键F5/浏览历史记录F7),以下键可以在cmd 中使用

  • F3- gets the last command
  • F5- gets the last command when you press it for the first time, then it iterates through the commands history
  • F8- gets the last command when you press it for the first time, then it iterates through the commands history (it can also go from the first one to the last one)
  • F3- 获取最后一条命令
  • F5- 第一次按下时获取最后一个命令,然后遍历命令历史记录
  • F8- 第一次按下时获取最后一个命令,然后遍历命令历史记录(也可以从第一个到最后一个)

A description for the functions above can be found on the Microsoft website.

可以在Microsoft 网站上找到上述功能的说明。

回答by No-one

You can just use the up and down arrows or F3

您可以只使用向上和向下箭头或 F3