10 Command Prompt Tricks that You Should Know
Command Prompt is a command-line interpreter application available in most Windows operating systems. It's used to execute entered commands. The command prompt (cmd.exe) is a native Windows application meant to act as a command-line interpreter. It was created by Microsoft for the OS/2, Windows CE, and Windows NT-based operating systems, which includes Windows 2000, XP and currently Windows 8 as well as various server versions of Windows. It is not a DOS program but a real executable application.
1. Encrypt Files Using Command Prompt
- Simply launch the Command Prompt, and change your working directory to the folder where your files are. This can be done by using the “cd” command.
- Once you’re done, type “Cipher /E“, and hit Enter. This will encrypt all the files that were inside the folder.
2. List Every Driver Installed on Your Windows 10 PC
- Type in driverquery /FO list /v in CMD, and you will see a list of drivers on your screen.
- If you want, you can also copy this output into a text file for easy viewing later. Use this command to save the drivers list to a document:
driverquery > C:\Users\YourUsername\Desktop\driver.txt
3. F1 to F9 Keys are Shortcuts in CMD
- F1: Tap or hold this key to retype your last command letter by letter.
- F2: Copies the current command up to a specified character.
- F3: Retypes the entire previous line
- F4: Auto-deletes the current command up to a specified character.
- F5: Similar to F3, but lets you cycle through previous commands.
- F6: Enters the EOF indicator into CMD.
- F7: Opens a list of previously entered commands.
- F8: Similar to F5, but doesn’t stop at the end of your command history in the session. Instead, it goes all the way to the start.
- F9: Enters a previous command by entering a number associated with that line.
4. Hide Folders using Command Prompt
- Launch Command Prompt, and navigate to the directory where your target folder resides.
- Type “Attrib +h +s +r folder_name“, replacing the “folder_name” with the name of the folder that you want to hide, and press Enter.
- You can now check that the folder is indeed hidden inside Windows Explorer and can not be seen by anyone.
- To unhide the folder, you can use the command “Attrib -h -s -r folder_name“.
Note: Hidden folders can be viewed using the cmd command “dir /AH”.
5. Copy Command Output to Clipboard
- Launch Command Prompt and type the command that you want to copy the output for, followed by “| clip“. For example, I’m using the command “ipconfig | clip“. Hit Enter, and you will see that the cmd window shows no output.
- Open a text editor, such as Notepad, and press Control + V, and you can simply paste the output of the command directly inside Notepad.
6. Open CMD Window Inside a Directory
- Open the directory in Windows Explorer. In the address bar, type “cmd”, and hit Enter.
- A command window will open inside the directory you had opened in Windows Explorer.
7. Generate Battery Health Report
- Launch Command Prompt as an Administrator or change directory using cd C:\Windows\System32
- Enter command powercfg/energy
- The system will take 60 seconds to analyze and then generate a report in form of HTML documents
- To access the report, you can head to this location on your Windows 10 computer:
8. Hide Sensitive RAR Files in Images
- Open CMD in the directory which contains both files using the 10th item in this list or use the cd command to change the directory
- Use command copy /b <RAR_filename>.rar + <image_filename>.<extension> <result_filename>.<extension>.
- In our case, we used copy /b modules.rar+wave.png test2.png
Note: make sure you enter the RAR file first followed by the other file, else you won’t be able to recover the RAR package. The method also works on most common file types including documents and PDFs as long as you add the archive file first.
- This will generate the result file, which in our case is test2.png
9. Always Run Command Prompt as Administrator
- Just search for “cmd” in the Start menu and right-click on it. After that, open its file location.
- Now copy the Command Prompt shortcut to your desktop.
- Move to desktop and right-click on the shortcut and open “Properties”.
- Here, click on Advanced and enable “Run as administrator”.
- Now onwards, open CMD from the desktop shortcut and it will always start with the Administrator privilege.
10. Delete Temp Files to Clear Space
- Use the command del /q /f /s %temp%\*
- Use the command del /s /q C:\Windows\temp\* (requires admin privileges)
- You can also use both the commands in one go by typing del /q /f /s %temp%\* && del /s /q C:\Windows\temp\*