Many people are familiar with Command Prompt, but few of them know that a lot of things can be achieved when using it. Today, loads of cool Command Prompt tricks will be discussed in this post of MiniTool. Check out this post now!
What Is Command Prompt?
Command Prompt is a command line interpreter application available in most Windows operating systems such as OS/2, eComStation, Windows NT, Windows CE, and ReactOS operating systems. It is also known as CMD or cmd.exe. With Command Prompt, you can troubleshoot or solve all kinds of Windows issues, such as hard drive errors, system file corruption and so on.
To access Command Prompt Windows 10, here are two frequently used methods.
Method 1. Run Command Prompt from Cortana
- Input CMD in the Cortana search box and choose the best match.
- Or right-click the best match and choose Run as administrator.
Method 2. Run Command Prompt from Run Box
- Press Windows+ R simultaneously to open the Run Input cmd and hit Enter.
- To run Command Prompt as an administrator, you can type cmd in the Run box and press Ctrl + Shift + Enter
Command Prompt is very helpful for Windows users to manage their computers. However, most people only focus on a few commands which are commonly seen on the Internet and they don't know there are many Command Prompt tricks and tips which are powerful and widely used.
Next, I will show you a handful of Command Prompt tricks. You may note done some commands if you have the need.
Top 10 Useful Windows Command Prompt Tricks
1. Command Prompt Keyboard Shortcuts
A very useful command prompt trick is to use Command Prompt keyboard shortcut keys. Knowing a few command prompt keyboard shortcuts can help you use command prompt in an efficient way and save your time.
- F1: Tapping or holding this key will retype the command that you just entered letter by letter.
- F2: Copy the current command up to a specified character.
- F3: Paste the previous line that you entered.
- F4: Delete the current prompt text up to a specified character.
- F5: Retype the previous command like F3 while still being able to cycle back through many lines in your command history.
- F6: Insert Ctrl+Z or ^Z in the Command Prompt. This is an end-of-file indication (text after this is ignored).
- F7: Display a list of previously entered commands which are selectable.
- F8: Retype the previous command but doesn't stop at the end of your command history. It will cycle back to the start.
- F9: Paste a previous command by entering a number associated with the line.
- Tapping the up and down arrows on your keyboard will cycle through commands that you've previously entered.
- Tab: When you're typing a folder path, tab will auto-complete and cycle through directories.
- Ctrl + F: Likewise, control + F now enables you to search for text in the Command Prompt.
If you're a frequent Command Prompt power user, these Command Prompt shortcuts can be very helpful for you and save your time. You can try the following shortcuts on your computer on your own.
2. Change Command Prompt Color
You can change the Command Prompt background and text color to make it look colorful.
Many users don't know that command prompt background can be changed. So this command trick is to tell you how to change Command Prompt color.
- Right-click on the Command Prompt window’s title bar.
- Select Properties in the context menu.
- Locate to the Colors tab on the top of the window.
- Select the color you'd like to change the background and text color to.
- Click OK to confirm the change.
Now you can change your Command Prompt background color with ease.
3. Abort a Command
You may encounter this situation: when you type a line of command and hit the Enter key, you find you just input a wrong command, so you want to stop the command immediately. Is there a way to stop the command in its tracks?
Well, at this time, you can use a command prompt trick to rescue the operation. All you need to do is to click Ctrl+C on your keyboard to abort the command. However, if the thing itself is undoable, this command may not work.
Try the magic Command Prompt trick on your computer now.
4. Delete Temporary Files
You can release some free space by deleting temporary files on your drive. A temporary file or temp file is a file created to hold information temporarily while a file is being created. After the program is closed, the temporary file is useless and should be deleted.
Some of the temporary files on your drive can be deleted with the following commands. But first, you need to run Command Prompt as administrator. Here are different commands for you to delete temporary files.
- Delete temporary user files:del /q /f /s %temp%\*
- Delete temporary system files:del /s /q C:\Windows\temp\*
- Run the two commands together:del /q /f /s %temp%\* && del /s /q C:\Windows\temp\*
You may be confused about some parameters in this command. The following is an illustration of their meanings for you.
- /q runs the operation without a confirmation prompt;
- /f ignores the read-only attribute and forces deletion;
- /s deletes the contents from all sub-folders.
Deleting temporary files is a way to help you free up disk space. There are loads of ways that can help you free up space on Windows. You can utilize tools like Space Analyzer to find large files on your drive and delete from the software directly.
5. Shut Down Your PC at a Certain Time via CMD
This command trick will show you how to shut down your PC at a certain time. You can schedule computer to shut down at a certain time in the night or any time with Command Prompt.
To make your computer shut down at a certain time via CMD, you can input the following command in the Command prompt window and hit Enter.
shutdown -s -t 3600
Your PC will shut down in one hour after running this command. To cancel the shutdown, you can enter shutdown –a command and press Enter to cancel it.
6. Create a Wi-Fi Hotspot & Find your Wi-Fi Password
Do you know that Command Prompt can help you create a Wi-Fi hotspot? May not, but don't worry because in this part, you will learn how this can be performed via the Command Prompt.
You can configure your PC to be a wireless hotspot if your network adapter supports the feature.
How to check if your hardware is capable:
- Input command netsh wlan show drivers in the command prompt window
- Look for the line that reads Hosted network support: Yes.
Then, you can enable the hotspot with this command:
- netsh wlan set hostednetwork mode=allow ssid=YOURSSID key=YOURPASSWORD
- netsh wlan start hostednetwork(stop works too)
- netsh wlan show hostednetwork (this is to check the status of your new hotspot)
You may also have to navigate through some GUI menus to enable connection sharing:
- Go to Network and Sharing > Change adapter settings (Control Panel\Network and Internet\Network Connections) and you should see the network adapters connected to your PC.
- Right-click the device that is connected to the Internet (not your new hotspot if that's listed) and open Properties.
- In the Sharing tab, check the box to Allow other network users to connect through this computer's Internet connection.
This command is to show your Wi-Fi password:
netsh WLAN show profile name=YOURPROFILE key=clear (look under Security settings > Key Content).
To delete a network profile you're no longer using:
netsh WLAN delete profile name=YOURPROFILE
7. Use Robocopy as a Backup Solution
Here is another command prompt trick that many users don't know. The robocopy command can help you backup files and folders. In this case, you don't need to use Window's backup software or install a third party program to manage your backups.
Note: You need to manually replace the source and destination folders with your own files and folders.
robocopy C:\source M:\destination /MIR /FFT /R:3 /W:10 /Z /NP /NDL
The robocopy command works the same as some incremental backup software, such as MiniTool ShadowMaker, keeping both locations in sync.
Note that if you're using Windows XP or earlier Windows versions, you don't have the robocopy command. But, you do have the xcopy command, which can help you backup files and folders:
xcopy c:\users\ellen\documents f:\mybackup\documents /c /d /e /h /i /k /q /r /s /x /y
If you want to backup partitions and disks, I recommend you to use professional disk and partition cloning software - MiniTool Partition Wizard Free Edition.
8. Fix Boot Issues
You may not know this Windows Command Prompt trick. When you are unable to boot your PC, you can fix boot issues with commands. You can create a bootable USB drive with Windows 10 Media Creation Tool, and then access Command Prompt in a recovery environment. Run the following commands to fix boot issues:
- bootrec /fixmbr
- bootrec /fixboot
- bootrec /scanos
- bootrec /rebuildbcd
There are also some other commands that can help you fix boot issues in different cases, but this one is the most effective. Next time when you encounter Windows boot issues, try this Command Prompt trick!
9. Scan System files for Corruption
It is always a good idea to check system files on a regular basis. How to scan and check system files in Command Prompt? Well, sfc /scannow command can help you.
The sfc /scannow command runs a system file checker tool that scans Windows system files. If there are some system files missing or corrupted, this command will fix them.
Open Command Prompt as an administrator and input sfc /scannow to run the system file checker now.
Many users reported the issue - Windows 10 SFC scannow unable to fix files after installing July 9 updates. Now, Microsoft has confirmed this issue.
10. Manage Disks and Partitions with Commands
You can run diskpart in Command Prompt to manage all disks and partitions on your computer, which is convenient and intuitive.
You can use diskpart create partition, delete partition, format partition, convert disk, clean disk, set partition active and so on.
To manage a disk, you need to select the disk first. To manage a partition, you need to select a partition first. Here I will show you how to format partition in Command Prompt as an example.
Input the following commands one by one and hit Enter after each one:
- list disk
- select disk *(* represents the disk number)
- list partition
- select partition *(* represents the target partition number)
- format fs=ntfs quick
After that, the partition has been formatted to an ntfs file system. Using Command Prompt to manage disks and partitions is very simple. However, if you are not familiar with commands, you may make mistakes during the operating process, causing unexpected data loss.
Many of you are facing hard drive recovery issue in daily life and work. Now, you can use the MiniTool data recovery software to recover files from hard drive.
Consider this situation, you can choose a reputable and reliable partition manager to help you manage disks and partitions. Here I recommend MiniTool Partition Wizard Free Edition, which is a safe, easy-to-use and powerful partition manger.
To manage a partition or disk, you just need to select the target one and choose the corresponding feature from the left action panel or the right-click menu; follow the prompts to continue and click Apply lastly.
If you need one, you can click here to download the free partition manager.
I am sure you have learned many useful command prompt tricks Windows 10 in this article. If you find this helpful, you may share this piece with your friends.
If you have any questions, you can leave a message on the following comment zone and we will reply as soon as possible. If you have different suggestions, we are glad to have you share them with us. If you need any help when using MiniTool software, you may contact us via [email protected].
Command Prompt Tricks FAQ
- Type cmd in the Windows search box and click on Command Prompt to open it.
- Right click on the Command Prompt window’s title bar.
- Choose Properties in the context menu.
- Select the color you'd like to under the Colors tab.
- Click OK to make the command prompt colorful immediately.