Menu
Even if you use the Windows Command Prompt a lot, you might be surprised at the number of useful keyboard shortcuts it supports. You can use them to streamline everything from selecting and manipulating text to repeating commands you’ve already typed. And we’ve got the full list for you.
The Command Prompt is a powerful tool in Windows, giving you access to all kinds of useful commands you can’t get any other way. By its very nature, the Windows Command Prompt relies on a lot of keyboard use–and with that comes handy shortcuts. Most of these shortcuts have been around since the Command Prompt’s early days. Some are new with Windows 10 (especially some of those that use the Ctrl key) and you’ll need to enable them before you can use them. When you’ve done that, you’re ready to unleash your full-fingered keyboard fury.
Shortcuts for Launching and Closing the Command Prompt
Windows actually boasts a number of ways to open the Command Prompt. The following list shows you some of the ways you can open and close the Command Prompt with just your keyboard:
- Windows (or Windows+R) and then type “cmd”: Run the Command Prompt in normal mode.
- Win+X and then press C: Run the Command Prompt in normal mode. (New in Windows 10)
- Win+X and then press A: Run the Command Prompt with administrative privileges. (New in Windows 10)
- Alt+F4 (or type “exit” at the prompt): Close the Command Prompt.
- Alt+Enter: Toggle between full-screen and windowed mode.
And while any of those ways to open the Command Prompt will work, we recommend getting used to opening it with administrative privileges. Most of the interesting commands you’ll use require it anyway. Sonic adventure dx vs dreamcast.
Note: If you see PowerShell instead of Command Prompt on the Windows+X (Power Users) menu, that’s a switch that came about with the Creators Update for Windows 10. It’s very easy to switch back to showing the Command Prompt on the Power Users menu if you want, or you can give PowerShell a try. You can do pretty much everything in PowerShell that you can do in Command Prompt, plus a lot of other useful things.
Shortcuts for Moving Around
You can always click with your mouse to place the cursor anywhere you want in the Command Prompt. But if you like to keep your hands on the keys, we’ve got you covered with these shortcuts for moving around:
- Home/End: Move the insertion point to the beginning or end of the current line (respectively).
- Ctrl+Left/Right Arrow: Move the insertion point to the beginning of the previous or next word (respectively) on the current line.
- Ctrl+Up/Down Arrow: Scroll the page up or down without moving the insertion point.
- Ctrl+M: Enter or exit Mark Mode. While in mark mode, you can use all four arrow keys to move your cursor around the window. Note that you can always use the Left and Right arrow keys to move your insertion point left or right on the current line, whether Mark Mode is on or off.
Once you get used to moving around with the keyboard, you might even find it faster than switching to the mouse and back again.
Shortcuts for Selecting Text
Since text is the currency of the Command Prompt, it shouldn’t surprise you to learn that there are all kinds of keyboard shortcuts available for selecting text on the screen. Different shortcuts allow you to select text a character, a word, a line, or even a whole screen at a time.
- Ctrl+A: Selects all text on the current line. Press Ctrl+A again to select all text in the CMD buffer.
- Shift+Left Arrow/Right Arrow: Extend current selection by one character to the left or right.
- Shift+Ctrl+Left Arrow/Right Arrow: Extend current selection by one word to the left or right.
- Shift+Arrow Up/Arrow Down: Extend current selection by one line up or down. The selection extends to the same position in the previous or next line as the position of the insertion point in the current line.
- Shift+Home: Extend current selection to the beginning of a command. Press Shift+Home again to include the path (e.g., C:Windowssystem32) in the selection.
- Shift+End: Extend current selection to the end of the current line.
- Ctrl+Shift+Home/End: Extent current selection to the beginning or end of the screen buffer (respectively).
- Shift+Page Up/Page Down: Extend current selection by one page up or down.
It may seem like a lot to remember when you can just select text using your mouse and, obviously, whichever way works best for you is the right way to do things. But we’re guessing that if you give yourself a bit of time to get used to the keyboard shortcuts, you might find that it’s actually easier than going for the mouse every time.
Shortcuts for Manipulating Text
Once you’ve selected text, it makes sense that you’d need to be able to manipulate what you’ve got selected. The following commands give you quick ways to copy, paste, and delete selections.
- Ctrl+C (or Ctrl+Insert): Copy currently selected text. Note that this only works if you some text selected. If you don’t, then Ctrl+C aborts the current command (which we describe more in just a bit).
- F2 and then a letter: Copy text to the right of the insertion point up to the letter you typed.
- Ctrl+V (or Shift+Insert): Paste text from the clipboard.
- Backspace: Delete the character to the left of the insertion point.
- Ctrl+Backspace: Delete the word to the left of the insertion point.
- Tab: Autocomplete a folder name.
- Escape: Delete the current line of text.
- Insert: Toggle insertion mode. When insertion mode is on, anything you type is inserted at your current location. When it’s off, anything you type overwrites what’s already there.
- Ctrl+Home/End: Delete text from the insertion point to the beginning or end of the current line.
- Ctrl+Z: Marks the end of a line. Text you type after that point on that line will be ignored.
Obviously, the shortcuts for copying and pasting are the most welcome additions in Windows 10. Hopefully, though, you can get some use out of the others.
Shortcuts for Working with the Command History
Finally, the Command Prompt keeps a history of all the commands you’ve typed since you started your current session. It’s easy to access previous commands and save yourself a little typing.
- F3: Repeat the previous command.
- Up/Down Arrow: Scroll backward and forwards through previous commands you’ve typed in the current session. You can also press F5 instead of the Up Arrow to scroll backward through the command history.
- Right Arrow (or F1): Recreate the previous command character by character.
- F7: Show a history of previous commands. You can use the Up/Down arrow keys to select any command and then hit Enter to execute the command.
- Alt+F7: Clear the command history.
- F8: Move backward in the command history to commands matching the current command. This is useful if you want to type part of a command you’ve used several times and then scroll back in your history to find the exact command you want to repeat.
- Ctrl+C: Abort the current line you’re typing or a command that is currently executing. Note that this command only aborts a line you’re typing if you have no text selected. If you do have text selected, it copies the text instead.
And that’s about it. If you use the Command Prompt a lot, you’ll find a lot of these keyboard shortcuts really useful for saving you some time and potentially mistyped commands. Even if you use the Command Prompt only on occasion, learning a few basic shortcuts for getting around more easily is worth your while.
READ NEXT- › How to Move Google Authenticator to a New Phone (or Multiple Phones)
- › Why Did Your iPhone Beep or Vibrate? Here’s How to Find Out
- › Why You Should Buy AMD’s 2019 CPUs for Your Next PC
- › How to Use the pinky Command on Linux
- › How to Check If Apple Has Recalled Your MacBook (For Free Repairs)
This document covers the basic in navigating and using the Microsoft Windows command line. On this page, you'll learn how to move around in the command line, find files, manipulate files, and other important commands. Keep in mind that there are over 100 different commands that have been used in MS-DOS and the Windows command line. If you are interested in learning about the command line in more detail, see our DOS and command prompt overview, which gives a description and example for every command.
Get into the Windows command line
Open a Windows command line window by following the steps below. If you need additional information or alternative methods for all versions of Windows, see our how to get into DOS and Windows command line page.
- Click Start.
- In the Search or Run line, type cmd (short for command), and press Enter.
Understanding the prompt
After following the above steps, the Windows command line should be shown (similar to the example below). Windows often starts you at your user directory. In the example below, the user is Mrhope, so our prompt is C:UsersMrhope>. This prompt tells us we are in the C: drive (the default drive letter of the hard drive) and currently in the Mrhope directory, which is a subdirectory of the Users directory.
Key tips
- MS-DOS and the Windows command line are notcase sensitive.
- The files and directories shown in Windows are also found in the command line.
- When working with a file or directory with a space, surround it in quotes. For example, the directory My Documents would be 'My Documents' when typed.
- File names can have a long file name of 255 characters and a three character file extension.
- When a file or directory is deleted in the command line, it is not moved into the Recycle Bin.
- If you need help with any of command, type /? after the command. For example, dir /? would give the options available for the dir command.
Listing the files
Let's learn your first command. Type dir at the prompt to list files in the current directory. You should get an output similar to the example image below. Without using any dir options, this is how dir output appears. As can be seen, you are given lots of useful information including the creation date and time, directories (<DIR>), and the name of the directory or file. In the example below, there are 0 files listed and 14 directories as indicated by the status at the bottom of the output.
Every command in the command line has options, which are additional switches and commands that can be added after the command. For example, with the dir command, you can type dir /p to list the files and directories in the current directory one page at a time. This switch is useful to see all the files and directories in a directory that has dozens or hundreds of files. Each of the command options and switches is listed in our DOS command overview. We offer guides for individual commands, as well. For example, if you want to see all the options for the dir command, refer to our dir command overview for a complete option listing.
The dir command can also be used to search for specific files and directories by using wildcards. For example, if you only wanted to list files or directories that begin with the letter 'A' you could type dir a* to list only the AppData directory, in this above example. See the wildcard definition for other examples and help with using wildcards.
Moving into a directory
Now that we've seen a list of directories (shown below) in the current directory, move into one of those directories. To move into a directory, we use the cd command, so to move into the Desktop type cd desktop and press Enter. Once you've moved into a new directory, the prompt should change, so in our example, the prompt is now C:UsersMrhopeDesktop>. Now in this desktop directory, see what files are found in this directory by typing the dir command again.
Understand the files
In the Desktop directory, as shown in the above example, there are 23 files and 7 directories, representing different file types. In Windows, you are familiar with files having icons that help represent the file type. In the command line, the same thing is accomplished by the file extensions. For example, 'forum posts.txt' is a text file because it has a .txt file extension. Time.mp3 is an MP3 music file and minecraft.exe is an executable file.
For most users, you'll only be concerned with executable files, which as mentioned above, is a file that ends with .exe and are also files that end with .com and .bat. When the name of these files are typed into the command line, the program runs, which is the same as double-clicking a file in Windows. For example, if we wanted to run minecraft.exe typing 'minecraft' at the prompt runs that program.
NoteKeep in mind that if the executable file you are trying to run is not in the current directory, you'll get an error. Unless you have set a path for the directory that contains the executable file, which is how the command line finds external commands.
If you want to view the contents of a file, most versions of the command line use the edit command. For example, if we wanted to look at the log file hijackthis.log we would type edit hijackthis.log at the prompt. For 64-bit versions of Windows that do not support this command, you can use the start command, for example, type start notepad hijackthis.log to open the file in Notepad. Further information about opening and editing a file from the command line can also be found on the link below.
Moving back a directory
You learned earlier the cd command can move into a directory. This command also allows you to go back a directory by typing cd. at the prompt. When this command is typed, you'll be moved out of the Desktop directory and back into the user directory. To move back to the root directory type cd to get to the C:> prompt. If you know the name of the directory you want to move into, you can also type cd and the directory name. For example, to move into C:Windows> type cdwindows at the prompt.
Creating a directory
Now with your basic understanding of navigating the command line let's start creating new directories. To create a directory in the current directory, use the mkdir command. For example, create a directory called 'test' by typing mkdir test at the prompt. If created successfully, you should be returned to the prompt with no error message. After the directory is created, move into that directory with the cd command.
Switching drives
In some circumstances, you may want to copy or list files on another drive. To switch drives in the Windows command line, type the drive letter of the drive followed by a colon. For example, if your CD-ROM drive was the D drive, you would type d: and press Enter. If the drive exists, the prompt will change to that drive letter. If the drive does not exist or is not accessible (e.g., no disc in CD-ROM drive) you will get an error.
Creating a new file
You can create a new file from the command line using the edit command, copy con command, or using the start command to open a file.
Creating a new batch file
In the new test directory let's create your first file. In most circumstances, you never need to create any file at the command line, but it is still good to understand how files are created. In this example, we are creating a batch file. A batch file is a file that ends with .bat and is a file that can help automate frequently used commands in the command line. We are calling this batch file example, so type edit example.bat at the prompt. As mentioned in the document on creating a file, if the edit command does not work with your version of Windows, use the start command to open the batch file in Notepad. To perform this action, you type start notepad example.bat into the prompt.
Both of the above commands open a new blank example.bat window. In the file, type the below three lines, which clear the screen with the cls command and then run the dir command.
However, she soon betrays him, steals all his money, and accuses him of taking advantage of her.For his alleged crimes, Naofumi is branded a criminal and made outcast of society. With hatred filling his heart, he sets out alone, vowing vengeance against those who wronged him. Summary:Stories of old tell of four otherworldly heroes—wielding the sword, spear, bow, and shield—who defended the land from wave after wave of calamity.
When the heroes part ways to start their journeys, he only has one willing companion: the beautiful princess Malty Melromarc. With the fate of the world in balance, the kingdom of Melromarc summons these legendary figures; in modern-day Japan, the call is answered, and the unwitting heroes are transported to this fantasy universe.Thrust into Melromarc and given the title of 'Shield Hero,' otaku Naofumi Iwatani is labeled the weakest due to his lack of offensive capability and apparent inexperience.
After these three lines have been typed into the file, save, and exit the file. If you are in the edit command, click File (or press Alt+F) and then Save. After the file is saved and you are back into the command prompt, typing dir should display the example.bat in the test directory.
Now run the batch file to get a better understanding of what a batch file does. To run the batch file type example at the prompt, which executes the batch file and clears the screen and then runs the dir command.
Moving and copying a file
Now that we've created a file let's move it into an alternate directory. To help make things easier, create another directory for the files. So, type mkdir dir2 to create a new directory in the test directory called dir2. After the new directory is created, use the move command to move the example.bat file into that directory. To do this type move example.bat dir2 at the prompt, if done successfully you should get a message indicated the file was moved. You could also substitute the move command for the copy command to copy the file instead of moving it.
Rename a file
After the file is moved into the dir2 directory, move into that directory with the cd command to rename the file. In the dir2 directory, use the rename command to rename the example file into an alternate name. Type rename example.bat first.bat at the prompt to rename the file to first.bat. Now when using the dir command, you should see the first.bat as the only file.
TipWhen renaming any file, make sure the file has the same file extension. If you were to rename the .bat file to a .txt file, it is no longer an executable file only a text file. Also, keep in mind that renaming the file to a different file extension does not convert the file. For example, if you were to name the file to a .MP3 file it may look like an MP3 audio file in Windows, but it is not going to play music.
Deleting a file
Now that we've had our fun with our new file, delete the file with the del command. Type del first.bat to delete the first.bat file. If successful, you are returned to the prompt with no errors, and the dir command shows no files in the current directory.
TipWhen deleting files, you can also use wildcards to delete multiple files at once. For example, if the directory contained several .GIF image files you could type del *.gif to delete all files ending with the .gif file extension.
Renaming a directory
Go back one directory to get back into the test directory by using the cd. command mentioned earlier. Now rename our dir2 directory to something else using the same rename command we used earlier. At the prompt, type rename dir2 hope to rename the directory to hope. After this command is completed, type dir and you should now see one directory called hope.
Removing a directory
While still in the test directory, remove the hope directory by using the rmdir command. At the prompt, type rmdir hope to remove the hope directory.
TipIf the directory you are trying to remove contains any files or directories, you'll receive an error. To prevent this error, use the /s option. For example, if the hope directory still had the first.bat file, you would need to type rmdir /s hope Best mods ps4 fallout 4. at the prompt.
Running a program
Any file that is an executable file can be run from the command line by typing the name of the file. For example, if you listed files using the dir command and see a file named 'myfile.exe' typing 'myfile' at the command line runs that program.
How to list available commands
After getting a good understanding of using the command line from the steps shown above, you can move on to other available commands by typing help at the command line. Typing 'help' gives you a listing of available commands with a brief description of each of the commands.
Closing or exiting the command line window
After you are done with the Windows command line, you can type exit to close the window.
Go Back In Cmd Prompt
In conclusion
Go Back In Command Line Windows
You should now have a good understanding of how to navigate thecommand line, create directories and files, rename directories and files, and delete. As mentioned earlier, there are hundreds of other commands that can be used at the command line. If you want to expand your knowledge even more, we recommend looking at the options available for each of the above commands and go through our commands overview. You can also use our search to find any command by the name of the command or by the action it performs.
Additional information
Go Back In Cmd
- See the MS-DOS and command line pages for further related information.