The best 15 command prompt tricks for Windows!

  • Por Sophia Silva
  • 08/12/2021 às 21:08 atualizado em (08/12/2021 às 21:08)
  • 10min de leitura

Although it is no longer used as much, there are many command prompt tricks that can make it a useful tool.

As many users no longer use the command prompt (also known as cmd), Microsoft has brought some improvements since Windows 10 (and even more on WIndows 11).

Many things you can only do from the command prompt and aren’t available from the GUI (Graphical User Interface), so it’s something you should use.

In this article, check out some command prompt tricks you need to know and come check out how to boot Windows in recovery environment!

1. List all drivers installed on your PC

If you’re trying to troubleshoot a problem or looking for a list of all your windows drivers, there’s a trick you can use.

Follow the step by step below to list the drivers:

  • Run command prompt as Administrator.
  • Type driverquery to see a simplified list.

List all drivers installed on your PC command prompt tricks

  • Type driverquery /v to see a list with detailed information.
  • Type driverquery /FO list to see a list that is best readable.

If desired, you can also copy this output to a text file for easy viewing later. Use this command to save the list of drivers in a document:

driverquery > C:\Users\[Username]\Desktop\driver.txt

2. All shortcuts in CMD from F1 to F9

All keyboard function keys (F1 to F9) are also shortcuts to functions within the command prompt, which makes them great tricks. Below you can see what each function key on your keyboard does in CMD:

  • F1: Type or hold to retype your last command letter by letter.
  • F2: Copies the current command up to a specific character.
  • F3: Retypes the entire previous command line
  • F4: Automatically deletes the current command up to a specific character.
  • F5: Similar to F3 but allows you to cycle through previous commands.
  • F6: Enter the EOF indicator into the CMD.
  • F7: Opens a list with previously entered commands.
  • F8: Similar to F5, but doesn’t stop at the end of your command history in the session. Instead, it goes from the beginning.
  • F9: Inserts a previous command, entering a number associated with that line.

3. Hide folders with command prompt

There is an easy way to hide folders in Windows via folder properties by checking the > Hidden checkbox, but the method is not very useful as this way the folders can be easily seen in the view options.

However, in the same way, you can hide folders using Terminal on macOS, you can do using command prompt.

That way, you can hide your folders so they’re completely hidden and Explorer won’t be able to show them. Just follow the step by step:

  • Run command prompt as Administrator.
  • Browse to the directory where the destination folder is.
  • Type “Attrib + h + s + r folder_name“, and replace “folder_name” with the name of the folder you want to hide and press Enter.
  • Now you can check if the folder is really hidden in Windows Explorer and cannot be seen by anyone.
  • To redisplay the folder, you can use the command ” Attrib -h -s -r folder_name“.

4. Generate battery health report

In Windows it is possible to track vital statistics related to battery health, keeping the data related to the battery. Which can be useful for notebook users.

This feature includes statistics such as factory specs, total battery capacity, and current capacity, which are updated with each usage session.

Through the command prompt you can generate a report about these statistics, and you can use one of the best tricks as follows:

  • Run command prompt as Administrator.
  • Type powercfg /energy.
  • The system takes 60 seconds to analyze and generate a report in the form of HTML documents.

To access the report, you can access this location on your computer: C: \ Windows \ system32 \ energy-report.html

Generate battery health report command prompt tricks

5. Hide confidential RAR files in images

Command prompt allows you to ‘merge’ two files into one. While this command is useful for merging the contents of more basic file types like TXT or CSV, you can also use it to hide a RAR, ZIP, or another archived file inside an image or text file.

To do this, follow the step by step:

  • Run command prompt as Administrator.
  • Open Prompt in the directory containing the files and use the cd command to change the directory.
  • Type copy / b <RAR_filename> .rar + <image_filename>. <extension> <result_filename>. <extension>.

Important: Make sure you insert the RAR file first, followed by the other file, otherwise you will not be able to retrieve the RAR package.

The method also works on most common file types, including documents and PDFs, as long as you add the zipped file (RAR) first. This will generate the result file.

This PNG file is displayed as a normal image file, but when you open it with WinRAR or any other extraction tool, it extracts the RAR file which is hidden under the image file.

This is a good way to save your confidential files from curious friends or co-workers or even prevent them from being misused, even in the event of a data breach.

6. Abort command execution

This is one of the command prompt tricks everyone needs to know. Let’s say you run a specific command but accidentally end up running a different one.

In this case, to interrupt the execution of the command, just press Ctrl + C together and the operation will be automatically aborted.

7. Run command prompt as administrator permanently

Users who always deal with files and programs on Windows know when it’s necessary to use elevated privileges.

But command prompt runs the normal user account by default, which makes it harder to get Administrator access to run commands.

So to fix this you can change the behavior permanently and always run command prompt as Administrator.

  • Just search for “cmd” in the start menu.
  • Right-click and open the file location.
  • Now copy the command prompt shortcut to your desktop.
  • Go to the desktop and right-click on the shortcut and open “Properties”.
  • Here, click Advanced and enable “Run as administrator”.

From now on, you can open command prompt from the desktop shortcut and it will always start with Administrator privilege.

8. FC / Scannow

SFC (System File Checker or System File Checker) is a relatively new addition to command prompt, but it is one of its best tricks. It helps keep your computer clean and bug-free.

It is a useful command-line tool that will help you fix many system problems.

  • Run command prompt as Administrator.
  • Enter the command sfc /scannow

From there, the prompt will begin to check the integrity of all system files that are protected. Besides, it will also repair the damaged files if that is possible.

So in the future, if you face any problem, make sure you run this command on your Windows.

9. Find information about commands

Sometimes we run a command to perform a particular task, but we don’t know much about it. So if you want to learn about some command in a specific way, just add “/?” at the end of any command and press Enter.

From there, you will have a good overview of command usage and syntax. Take an example of the SFC from the trick above and type sfc /? and press Enter.

You will know the subcommands with examples, and what are the other commands related to SFC in a readable language.

Find information about commands command prompt tricks

10. View command history

Many users use the navigation keys to move back and forth between commands, but since you perform many commands, it quickly becomes a tiring exercise.

You can type the command doskey /historycommand to check all your executed commands against a chronological list. However, you cannot select commands and execute them instantly.

You will have to type it in manually and it is definitely not the best solution. So if you want to quickly navigate through all the previous commands with the ability to execute them immediately, just press the F7 key.

A separate window will open, where you can choose a command and run it right there. Because of that, this is one of the best command prompt tricks on our list.

Keep in mind that some users need to press the “Fn” key together with F7 to trigger this action.

11. Delete temporary files to free up space

If you’re low on space and urgently need to clean up the trash and get rid of your computer’s temporary files, this may be the fastest course of action.

Here’s what you can do to clean up your computer’s temporary files and regain a considerable amount of space.

  • Run command prompt as Administrator.
  • Type del /q /f /s% temp% \*
  • Then type del /s /q C: \Windows \temp \*
  • If you prefer, you can also use both commands at once by typing del /q /f /s% temp% \* && del /s /q C: \Windows \temp \*

12. Play an RPG game from the command prompt

This is, of course, a trick you didn’t expect to read on this list. If you’re into roleplaying games, you’ll want to check out Ateraan, which is a text-only roleplaying game that works from within the Windows command prompt.

  • Run Command Prompt as Administrator.
  • Type the command telnet 4002 and press Enter.

This will start the game and you will be able to create your character and start your journey.

13. Move to Windows Terminal

Although command prompt has many features, tricks, and its own user base, starting with Windows 10 Microsoft announced Windows Terminal, a universal command-line tool for Windows.

It runs command prompt in a layout that has the ability to run multiple commands in just one window. Alongside this, Microsoft has also merged Terminal Linux and PowerShell into Windows Terminal.

Basically, you will have access to all command-line tools side by side in just one window. So the recommendation is to try the new Windows Terminal and see if you like the feature.

14. Create a Wi-Fi hotspot

Another trick that can be very useful is to create a WiFi hotspot at the command prompt. There are many third-party tools that help with this, but this tip may make this process easier for some.

To do it, follow the step by step:

  • Run command prompt as Administrator.
  • Enter the following command: NETSH WLAN show drivers

Compatible Hosted Network lets you know if your computer supports wireless sharing.

If the field displays Yes, then your system is capable of sharing Wi-Fi. Once verified, enter the following command,

netsh wlan set hostednetwork mode=allow ssid=[Name] key=[Pwd]

Here, Name is the network name and Pwd is the password. From there, all you have to do is enter the final command:

netsh wlan start hostednetwork

Now, just let your friends relax and enjoy the benefits of a free Internet connection, all thanks to you.

15. Watch Star Wars

In our last trick in our list of command prompt tricks, we bring you the most unusual and fun command you’ll ever see.

Have you ever thought about watching Star Wars at the command prompt? Well, with this trick you can watch Star Wars: A New Hope in ASCII characters, right there in the command prompt.

This method uses Telnet, so you should make sure Telnet is enabled on your Windows. To enable Telnet, go to Control Panel > Programs > Programs and Features > Enable or disable Windows features and enable Telnet service.

After activating Telnet.

  • Run command prompt as Administrator.
  • After that, type “telnet” and press Enter.

Then just prepare the popcorn, because the Star Wars: A New Hope movie will start playing.

Did you like our list of command prompt tricks?

Were you able to take advantage of our list with some command prompt tricks? So leave a comment saying what you think and if you have any questions.