Microsoft

14 Windows 10 Command Line Tricks that Give You More Control Over Your PC

cmdtricks

Windows 10 has an incredible Graphics User Interface (GUI) that will often be enough for you to get things done.

But if your inner Oliver Twist wants more, then you should start learning about the Command Line.

With the command prompt, you get access to features that are not available in the GUI and you get to interact directly with your Windows 10 operating system.

In this article, I’m going to show you 14 command line tips and tricks that’ll help you feel like a superhero while using your computer and that will surely impress your friends as well.

Be aware that you should be very careful while executing commands in the command prompt because any command you execute might have a lasting effect on your computer.

Make sure you read until the end because I’m going to show you how to see the password of every Wi-Fi that has ever been connected to your computer.

1. How to Open the Command Prompt in any Folder

Not everyone wants the hassle of navigating around folders in the command line.

If you are one of those people like I am, you can open the folder directly in the command prompt by typing “cmd” in the folder address bar and then hitting ENTER

There you go!

2. How to Create a Secure Folder with the Command Prompt

For privacy reasons, you might want to create a folder that cannot be edited, moved, copied, or deleted by any random person that gets access to your computer.

To do this, navigate to the directory where you want to create this folder or open the command prompt directly in it with the first tip in this article. Then execute the command – md aux\.
ss-1

This will create a folder named “aux”. It cannot be deleted, edited, moved, or copied.

If you check and you can’t find the folder, refresh the directory in which you created the folder.
ss-2-2

So, what if you want to delete this folder? You can’t do that with the GUI, so you need to do it in the command line. Execute the command –rd aux\ – to delete the folder. Make sure the files in the folder are backed up.

3. How to Run the Command Prompt as an Administrator

Sometimes, you might need administrative privileges when you don’t have access to the GUI.

To get these, type in powershell "start cmd -v runAs and hit ENTER. Select Yes in the next prompt and it’ll open a new window of the command prompt with administrative privileges.
ss-3-2

4. How to Encrypt Files with the Command Prompt

If you’re not the only one who uses your Windows 10 computer and you want your files inaccessible to other users, you can encrypt the files by navigating to the folder where the files are located and typing in Cipher /E.
ss-4-1

Any other user apart from you will be unable to open the files.

5. How to Hide a Folder with the Command Prompt

So, what if you want to hide a folder? You can do that by typing in attrib +h +s +r folder_name and then hitting ENTER.

To show the folder again, execute the command – attrib -h -s -r folder_name.
ss-5-3

6. How to Change the Background Color and Font Color of the Command Prompt

If the old-school black and white colors of the command line look boring to you, you can change them to your desired color scheme.

To do this, launch the command prompt and run color -help. This will show you available colors represented by numbers and alphabets. You can change the background and font colors to.
ss-7

To change the colors properly, run color background_color_number font_color_number. For example, color 02 leaves the background color black and changes the font color to green.

ss-6-3

7. How to Change the Title of the Command Prompt Window

The title of an opened command prompt window doesn’t need to stay as the default – you can change it.

To do this, type in title window_title_name.
ss-8-2

8. How to Change the Prompt Text of the Command Prompt

The text that appears before you type your commands might not be attractive enough for you. For me, it isn’t, so I’ve changed it.

To change the prompt text, type in prompt prompt_name $G and hit ENTER.
The “$G” in front of the specified prompt name will append the greater than (>) symbol for you, so you can know where your command starts – a better UX for you, by you!
ss-9

9. How to Change the Font Size of the Command Prompt Texts

If the default font size of the command prompt is too small for your eyes, you can change it. You don’t even need to run a command for this.

Step 1: Right-click on the command prompt window and select “properties”.
ss-10-1

Step 2: Switch to the font tab and select your desired font size, then click “Ok”.
ss-11-2

10. How to Generate Battery Health Report with the Command Prompt

With this, you get to know the state of your laptop battery and what to do to improve it. In fact, this is my favorite thing that the command prompt lets me do.

To generate a battery health report, make sure you are running the command prompt as an administrator. Then enter the command powercfg/energy and hit ENTER.
ss-12

An HTML file you can open with the browser will be generated for you in 60 seconds.
You can locate the HTML file in C:\Windows\system32\energy-report.html.

11. How to Log on to a Website from the Command Prompt

You can open a website from the command prompt by typing in start www.website_name.com and then hitting ENTER. Then the website will open in your default browser.
ss-13

ss-14-1

Note that you must append “www” before the domain name, otherwise, it doesn’t work.

12. How to see the IP Address of a Website with the Command Prompt

You can check the IP address of any website by typing ping www.website_name.com and then hitting ENTER.
ss-15

Note that you must append “www” before the domain name, otherwise, it doesn’t work.

13. How to Show All Wi-Fi Passwords with the Command Prompt

You can check the password of your current WiFi connection with the GUI. But the command prompt also shows the passwords of every WiFi that has ever connected with your computer.

To check the passwords, run the command – for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear and hit ENTER.

You can find the key right in front of “Key content”.
ss-16

I blurred out the key, as some of my neighbors read my freeCodeCamp articles. 🙂

14. How to Shut Down Your Computer With the Command Prompt

Now that you’ve learned about 11 helpful commands that’ll make you feel like a boss, here’s one more: shut down or restart your computer with the command prompt.

To shut down your computer with the command prompt, run the command shutdown -s.
To restart your computer, enter shutdown -r and hit ENTER.

To set a countdown for when your computer will shut down, enter shutdown /s /t time_in_seconds and hit ENTER.
ss-17

To set a countdown and an alert message for when your computer will shut down, enter shutdown /s /t time_in_seconds /c “alert_message”  and hit ENTER.
ss-18

Thank you for reading this article. If you find it helpful, please share with your friends and family.

Leave a Reply

Your email address will not be published. Required fields are marked *