You must have used the windows command prompt for many purposes. But we don’t use it to its full potential. In this post, we will take a look at some commands and some hacks which are very awesome and will help you in your life. So here are the top 10 windows command prompt commands/hacks.
Open command prompt in any directory.
To open the command prompt in any directory we need to traverse to that particular directory and click on the address bar and type cmd over there, you will get the command prompt open in that path.
Change the color of text and background
We can change the color of the text as well as the background of the command prompt using the color command. If you type help color you will get the available colors.
If you type COLOR 02 then the following will be the output. Here 0 represents the background color and 2 represents the foreground color i.e text color.
Change the prompt name.
If you type help prompt then on the command prompt you will get to see the all available options.
If you type your desired prompt name in front of the prompt command then that name will be set as a prompt name.
Change the title of command prompt
To change the title of the command prompt we use the title command.
As you can see the title of this command prompt previously was C:\Windows\System32\cmd.exe.
Hide files using command prompt
We can hide the files and folders using the following command.
Attrib +h +s +r filename
I have created the Codetej folder, as you can see dir returns the name of files and folders present in the current directory.
Now if you will go to that folder you will not get that Codetej folder. To get that folder there is one command.
Attrib -h -s -r filename
After executing this command you will be able to see that Codetej folder again.
Copy command output to clipboard
We can copy any command output to the clipboard and after that, we can paste that output anywhere.
command_name | clip
Get the command history
To get the command history you just need to press F7. Then you will get the box on your screen that will have the list of commands you have executed. Using arrow buttons you can select the commands and re-execute them.
Get the list of installed products on your system
To see the products installed on your system use the following command.
wmic product get name
Lock and unlock any particular file or folder.
You can lock any file or folder in windows by executing the below steps. I have created secret.txt which contains some random text.
To lock this file I will use the following command.
cacls filename.extension /P everyone:n
After executing this command you won’t be able to edit and view this file. If you try to open this file, it will show the following message.
To unlock the file using the following command.
cacls filename.extension /P everyone:f
Now you will be able to edit it and can see the file contents. You can hide folders using this command only, just replace the filename with the folder name.
These are some of the awesome and useful commands but there are more useful and awesome commands which you can explore.