键盘(Keyboard)快捷键可以为您节省大量时间,并且可以减少腕管综合征等重复性劳损 ( RSIs ) 的几率。(RSIs)因此,让我们来看看Windows 命令提示符(Windows Command Prompt)的最佳键盘快捷键。
(Keyboard Shortcuts)命令提示符控制台(Command Prompt Console)的键盘快捷键
这些快捷方式可帮助您控制将用于命令行对话框的实际窗口。
- Win + X然后C:打开命令提示符(Command Prompt)应用程序。如果它默认为Windows Terminal,它可能无法在Windows 11中运行。您也可以使用Win + R,然后键入cmd并按Enter。
- Win + C然后A:以管理员权限打开命令提示符应用程序。(Command Prompt)当然,这需要管理员凭据。如果它默认为Windows Terminal ,它可能无法在Windows 11中运行,那么该键盘组合将以管理员权限打开Windows Terminal 。
- F11或Alt + Enter: 用于(Use)在全屏和窗口模式之间切换命令提示符。(Command Prompt)
- Ctrl + Shift +加(Plus )号( + ) 和Ctrl + Shift +减号(Minus )( - ) : 增加(Increase)或减少命令提示符(Command Prompt)的不透明度。Ctrl + Shift +鼠标滚轮(mouse scroll wheel )做同样的事情。
- Win +箭头键:(Arrow Keys:) 最大化(Maximize)、最小化和在屏幕上移动命令提示符。(Command Prompt)
- Alt +鼠标滚轮:(Mouse Scroll Wheel:)放大和缩小命令提示符(Command Prompt),使文本变大或变小。
- Alt + F4:快速关闭命令提示符(Command Prompt)。
(Keyboard Shortcuts)命令提示符(Command Prompt)中光标(Cursor)和文本控件(Text Control)的键盘快捷键
无需鼠标即可选择或操作文本以及移动光标的键盘快捷键与其他Windows 10或 11 应用程序(如Excel或 Word )中的文本键盘快捷键(keyboard shortcuts)大致相同。
- Ctrl + M:将光标切换到标记模式(Mark Mode),让您可以用鼠标选择文本。要退出标记模式(Mark Mode),请按Esc。要判断您是否处于标记模式(Mark Mode),请查看命令提示符(Command Prompt)窗口的标题栏和光标。如果它在标题中显示Mark或光标是一个实心直立矩形,则您处于Mark Mode。
- Home或End: Home 将光标移动到命令行的开头,而 End 将光标移动到末尾。
- Shift + Home或Shift + End:Shift + Home选择从光标所在位置到命令行开头的所有文本。如果光标已经在开头,它将选择提示本身。Shift + End选择从光标到结尾的所有文本。
- Shift +右箭头(Right Arrow )或左箭头:(Left Arrow:)将当前选择向右或向左增加一个字符。
- Ctrl + Shift +右箭头(Right Arrow )或左箭头:(Left Arrow:)使用Ctrl + Shift组合键和左右箭头键将选择光标右侧或左侧的整个单词。
- 向上(Up )或向下箭头:(Down Arrow:)在标记模式下(Mark Mode),向上箭头向上移动光标,向下箭头将光标向下移动一行。不在标记模式下(Mark Mode)时,它会循环显示最近输入的命令。
- Ctrl +向上(Up )或向下箭头:(Down Arrow:)一次将页面向上或向下移动一行。这对于缓慢滚动大量文本很有用。
- Pg Up或Pg Down:在标记模式下,Page Up和Page Down键将在各自的方向上一次移动光标一页。
- Shift + Pg Up或Pg Dn:从光标中选择文本以向上或向下包含整个页面。
- Ctrl + A:第一次按下选择当前行中的所有文本。立即按第二次选择命令提示符窗口中的所有文本。
- Ctrl + C或Ctrl + Insert:两者都将复制当前选定的文本。如果您使用Ctrl + C并且没有选择文本,它将中断正在运行的命令(如果有的话)。
- Ctrl + Backspace:就像 Backspace 删除光标左侧的字符一样,Ctrl + Backspace 删除光标左侧的整个单词。
- Ctrl + Home或Ctrl + End:分别删除从光标到当前行开头或结尾的所有文本。
- Ctrl + Shift + Home或Ctrl + Shift + End:选择从光标到命令提示符(Command Prompt)顶部或底部的所有文本。在下图中,光标位于ipconfig /allcompartments,然后按下 Ctrl(Ctrl ) + Shift + End,选择窗口末尾的所有内容。
- Esc:删除整行或退出标记模式((Mark Mode)如果您在其中)。
- 插入:(Insert:)在插入模式之间切换以插入文本或覆盖文本。
- Ctrl + F:打开“查找”(Find )对话框以帮助搜索文本。您可以更改参数以匹配大小写,并通过命令提示符向上或向下搜索。
(Keyboard Shortcuts)与命令一起使用的键盘快捷键
键入每个字符或重复键入相同的命令会耗费大量时间。幸运的是,Microsoft包含许多命令提示符(Command Prompt)键盘快捷键,以帮助快速输入命令。
- 向上(Up )或向下箭头:(Down Arrows:)向上 ( ^ ) 将您向后移动到命令历史记录中的先前命令,向下 ( ˅ ) 将您向前移动。
- 右箭头:(Right Arrow:)按字母输入最近的命令字母。如果driverquery是最后执行的命令,按右箭头输入d,再次按输入r等。
- F2:将文本复制到当(F2:)Enter char to copy up to:对话框打开时键入的字符的第一个实例,在最后一个执行的命令中。例如,如果最后使用的命令是ipconfig /all,您输入F2并键入/,ipconfig将出现在命令提示符处。
- F4:删除文本,直到当(F4:)Enter char to delete up to:对话框打开时键入的字符的第一个实例。
- F5: 与向上箭头类似,只是在命令历史记录中向后退,一次一个命令。
- F7:打开命令历史记录,您可以使用向上和向下箭头在列表中移动。然后按Enter执行突出显示的命令。
- Alt + F7:清除命令历史记录。使用Alt + F7,然后只尝试F7,命令历史记录甚至没有打开,因为其中没有任何内容。
- F8: 从(Recalls)命令历史中调用以已经输入的文本开头的命令。在此示例中,F8将回滚之前使用的任何ipconfig命令。
- F9:根据其编号从命令历史记录中重新键入命令,如使用 F7 时所示。在上面显示的 F7 示例中,您将按F9打开Enter command number:对话框,然后键入17以输入diskpart。
- 选项卡:(Tab:)循环浏览当前命令中目录下的文件夹,以使用您停止的那个自动完成它。在下面的示例中,输入C:\ :,然后按下Tab一次,得到C:\$Recycle.Bin。
- Ctrl + V或Shift + Insert:将最后复制的文本粘贴到剪贴板。在下图中,您可以从剪贴板(Clipboard )历史记录窗口中看到它将是ipconfig /all
您现在可以使用Windows命令(Command)提示符(Windows Command Prompt)
也许您过去曾使用过一些命令行功能,并且使用正确的语法很方便。也许您甚至编写了一些批处理文件。现在您已经有了看起来像向导的快捷方式。不是微软(Microsoft)操作系统人员?
没关系——我们有Mac 快捷键(Mac shortcuts)甚至Linux 键盘快捷键(Linux keyboard shortcuts)。我们甚至向您展示了如何为 Microsoft Office(create keyboard shortcuts for Microsoft Office)和Windows创建键盘快捷键。你最喜欢的快捷键组合是什么?
The 36 Best Windows Command Prompt Keyboard Shortcuts
Keyboard shоrtcuts can save you a lot оf tіme, and they can reduce the chance of repetitive strain injuries (RSIs) like carpal tunnel syndromе. So let’s check out the best keyboard shortcuts for the Windows Command Prompt.
Keyboard Shortcuts for the Command Prompt Console
These are shortcuts that help you control the actual window that you’ll use for your command line dialog.
- Win + X then C: Opens the Command Prompt app. It may not work in Windows 11 if it’s defaulted to Windows Terminal. You can also use Win + R, then type cmd and press Enter.
- Win + C then A: Opens the Command Prompt app with administrator rights. This requires administrator credentials, of course. It may not work in Windows 11 if it’s defaulted to Windows Terminal, then that keyboard combo will open Windows Terminal with administrator rights.
- F11 or Alt + Enter: Use to switch Command Prompt between full screen and windowed mode.
- Ctrl + Shift + Plus (+) and Ctrl + Shift + Minus (–): Increase or decrease the opacity of the Command Prompt. Ctrl + Shift + mouse scroll wheel does the same thing.
- Win + Arrow Keys: Maximize, minimize, and move the Command Prompt around the screen.
- Alt + Mouse Scroll Wheel: Zooms in and out on the Command Prompt, making the text larger or smaller.
- Alt + F4: Quickly closes the Command Prompt.
Keyboard Shortcuts for Cursor and Text Control in the Command Prompt
The keyboard shortcuts to select or manipulate text and move the cursor around without a mouse are much the same as the text keyboard shortcuts in other Windows 10 or 11 apps, like Excel or Word.
- Ctrl + M: Switches the cursor to Mark Mode, which lets you select text with the mouse. To exit Mark Mode, press Esc. To tell if you’re in Mark Mode or not, look at the title bar of the Command Prompt window and the cursor. If it says Mark in the title or the cursor is a solid upright rectangle, you’re in Mark Mode.
- Home or End: Home moves the cursor to the start of the command line while End moves it to the end.
- Shift + Home or Shift + End: Shift + Home selects all text from where the cursor is to the beginning of the command line. If the cursor is already at the beginning, it will select the prompt itself. Shift + End selects all text from the cursor to the end.
- Shift + Right Arrow or Left Arrow: Increase the current selection by a character to the right or left.
- Ctrl + Shift + Right Arrow or Left Arrow: Using the Ctrl + Shift key combo with the right and left arrow keys will select the entire word to the right or left of the cursor.
- Up or Down Arrow: In Mark Mode, the up arrow moves the cursor up, and the down arrow moves it down a line per press. When not in Mark Mode, it cycles through recently entered commands.
- Ctrl + Up or Down Arrow: Moves the page up or down one line at a time. This is useful to scroll through a large amount of text slowly.
- Pg Up or Pg Down: When in Mark Mode, the Page Up and Page Down keys will move the cursor a page at a time in their respective directions.
- Shift + Pg Up or Pg Dn: Select text from the cursor to include a whole page up or down.
- Ctrl + A: The first press selects all text in the current line. An immediate second press selects all text in the command prompt window.
- Ctrl + C or Ctrl + Insert: Both will copy the text currently selected. If you use Ctrl + C and no text is selected, it will interrupt a running command if there is one.
- Ctrl + Backspace: Just as backspace deletes the character to the left of the cursor, Ctrl + Backspace deletes the entire word to the left of the cursor.
- Ctrl + Home or Ctrl + End: Deletes all text from the cursor to the start or end of the current line, respectively.
- Ctrl + Shift + Home or Ctrl + Shift + End: Selects all text from the cursor to the top or bottom of the Command Prompt. In the image below, the cursor was at the start of the ipconfig /allcompartments, and then Ctrl + Shift + End was pressed, selecting everything to the end of the window.
- Esc: Deletes the entire line or escapes Mark Mode if you’re in it.
- Insert: Changes between insert modes to either insert text or overwrite the text.
- Ctrl + F: Opens the Find dialog to help search through text. You can change the parameters to match the case and search up or down through the command prompt.
Keyboard Shortcuts to Use with Commands
Typing every character or repeatedly typing the same commands is a huge time drain. Fortunately, Microsoft includes many Command Prompt keyboard shortcuts to help enter commands quickly.
- Up or Down Arrows: Up (^) moves you back through the previous commands in the command history, and down (˅) moves you forward.
- Right Arrow: Enters the most recent command letter by letter. If driverquery was the last command executed, pressing the right arrow types d, pressing again types r, etc.
- F2: Copies text up to the first instance of the character typed when the Enter char to copy up to: dialog is open, in the last command executed. For example, if the last command used was ipconfig /all, you enter F2 and type /, ipconfig will appear at the command prompt.
- F3: Recalls the last command from the command history.
- F4: Deletes text up to the first instance of the character typed when the Enter char to delete up to: dialog opens.
- F5: Works similarly to the up arrow, only going backward in the command history, one command at a time.
- F7: Opens the command history, and you can use the up and down arrows to move through the list. Then press Enter to execute the command that’s highlighted.
- Alt + F7: Clears the command history. Use Alt + F7 and then try just F7, and the command history doesn’t even open because there’s nothing in it.
- F8: Recalls commands from the command history which begin with the text already entered. In this example, F8 would scroll back through any previous ipconfig commands used.
- F9: Re-types a command from the command history based on its number, as shown when using F7. In the example shown above for F7, you’d press F9 to open the Enter command number: dialog and then type 17 to enter diskpart.
- Tab: Cycles through folders under the directory in the current command to autocomplete it with the one you stop on. In the example below, C:\ was typed in, then Tab was pressed once, giving us C:\$Recycle.Bin.
- Ctrl + V or Shift + Insert: Pastes last text copied to the clipboard. In the image below, you can see that it’ll be ipconfig /all from the Clipboard history window.
You’re in Command of the Windows Command Prompt Now
Maybe you’ve used some command-line features in the past, and you’re handy with the proper syntax. Perhaps you’ve even written some batch files. Now you’ve got the shortcuts to look like a wizard. Not a Microsoft operating system person?
That’s alright—we’ve got Mac shortcuts and even Linux keyboard shortcuts. We even show you how to create keyboard shortcuts for Microsoft Office and Windows. What are your favorite shortcut key combos?