The CMD commands in Windows are very useful. These commands allow us to do our work very quickly and efficiently. Although, the Windows GUI interface allows us to do pretty much all the stuff sometimes we need to use the command prompt.
Many people when using Windows only deals with the GUI Windows interface, so they don’t have an idea about any cmd commands and even what command prompt is.
CMD Commands Tricks And Hacks
So in this tutorial, you’ll learn how to use command prompt for beginners. If you already know about command prompt and want to just have a look at it commands then please skip to the bottom.
Apart from just basic commands, I’ll be talking about some real tricks and hacks that you can do with cmd commands.
Let’s dive right in.
Multiple Ways To Open Command Prompt
So the first way by using the run utility.
Press Windows key + R to open the run dialog box
Then type cmd inside it and hit enter. You’ll see that the command prompt has appeared.
The second way is just by searching your installed programs. Just type in cmd in the search box and choose the option which says cmd.
So the third way is very useful. It made my life a whole lot easier when I discovered that we can open cmd directly inside any folder.
Simply go to the folder where you want to open the cmd.
In the navigation box type cmd and hit enter.
You’ll see that the command prompt has opened in the same folder. This trick saves a lot of time for me.
Many times to make a change on system level you have to open the command prompt as an admin. To open the command prompt as an administrator simply go to the start menu and search for cmd. Then right click on cmd and choose the option run as administrator.
Turn Your Normal CMD To A Hacker CMD
You probably have seen in movies that hackers use terminals with a black screen and green text on it.
This can be done on windows command prompt by just using a simple hack.
Just type in color /? And hit enter. You’ll see a listing of colors that you can use with their respective code.
To make the command prompt text green we will use the command color 02
The first digit is for background color which is 0, it stands for black color and the second digit is for text color which is 2, it stands for green color.
Alternatively, you can also change colors by right-clicking on the top bar and then going to Properties->colors. Play around with this command and find out what color combination do you like the most.
You can also change the prompt name by simply typing prompt <new prompt name>
Now you’ll see that the prompt text has changed to whatever text that you have chosen. This cmd command really allows us to customize the command prompt to our style. Use this trick to name the prompt text to whatever you want.
To change the prompt to default type prompt without any argument and hit enter.
When you find yourself running a lot of commands on the command prompt your screen will be filled with lots of text.
This will make it harder to read to what is displayed on the screen. So, for our comfort, we use a command called cls.
This command is short for the clear screen and it does the same thing, it clears the cmd screen.
Simply type the command cls and see the magic.
Exit Command Prompt
When you have finished all of your work on the command prompt, you can simply type in exit and hit enter.
You’ll be immediately taken out of the cmd window.
Change Date & Time Through Command Prompt
I personally think that this hack is the quickest way to change data and time on the windows system.
Simply Open the command prompt as an administrator, and type in the time and hit enter.
Enter the new time, hit enter and there you have it.
For changing the date type the command date and hit enter.
Then type in the new date in the format day/month/year and hit return.
Display Contents Of A Folder
Navigate to the folder whose content you want to see. I showed you a simple trick above, how to open the cmd in any location.
Open the command prompt and type dir /a
This command will list all the directories of the folder in which you currently are.
It will also show you the hidden files that you can’t normally see in the file explorer.
See in the image the folder 2 is not visible, but the cmd is telling me that there is a folder named folder 2. This is because I have hidden that folder, but it is still showing in command prompt.
Changing Folder And Drives
Type cd <folder name>
You’ll be taken to that folder.
If you want to go one step back type in cd.. and hit enter.
For changing the drive, type the drive letter followed by a colon, then press enter. For example k:
You’ll see that your drive has changed successfully.
Basic Files And Folder Operations Using Command Prompt
Basic operations of files and folders include creating, rename, copy, move and delete. So here are all the operations that can be done using windows cmd commands.
Creating A File & Folder
To create a new folder, we use the command md <folder name>.
Alternatively, you can use the command mkdir <folder name> to create a folder.
For creating a file simply type the command start <program name> <file name>
See the image below, how I created a notepad file using the above command.
You can also create a Microsoft word file by typing using the same command. For example, start winword newfile.docx
Note: You don’t need to put the extension when creating a file. The program itself will take care of it.
Rename A File & Folder
To rename a folder or file name, use ren <folder/file name> <new name>
You can also change the name using the command rename.
It’s all your choice use whichever command you like, I personally like to use short forms of these commands. It just makes things easier and quicker.
Copying Files & Folders
For copying a file and folder, you have to use the copy command.
Copy <filename> <new location>
See the example below:
Now, if you want to move a folder or a file then you can use the move command.
Move <filename> <new location>
Pay attention here, that I have used the double quotes around the folder name where I want to move my file. This is because the folder name has spaces in between. So if you don’t have any spaces in the folder name you can neglect the double quotes.
Note: Don’t forget to type the extension of the file that you want to copy or move.
Delete Files & Folders
The cmd command for deleting a file is del.
To delete or remove a file using the command prompt, type del <filename> and hit enter.
This will delete the file completely.
Notice, that I said completely, that means that the file will not go to recycle bin, it will be permanently deleted. So use this cmd command carefully.
For deleting a folder that has some contents inside it, such files and other folders use the command rd /s /q <folder name>.
This will completely delete the folder. Keep that in mind. You can also use rmdir instead of rd if you want to.
Hiding Your Files Using CMD
I guess you already know that we can hide our files by going to its properties and ticking the checkbox that says hidden.
But here I will show you a sneaky command prompt trick. This will allow you to hide files in a way that don’t show even when you have allowed showing the hidden files.
So the trick is to make the file or folder that you want to hide a system file and the hidden file as well.
Use the command attrib <filename> +s +h
Now the files will be hidden and it will become the system files as well. By default, the system files are not shown even when you allow to show the hidden files.
Shutdown, Restart, Logoff Using CMD
Do you know that you can shut down, restart and logoff of your PC using the command prompt?
If not here are the command that will help you to perform all these operations.
You can shut down your PC using the command shutdown /s
If you type this command in your command prompt and hit enter your computer will shutdown in under a minute. So don’t run this command now.
Even if you ran this command you can abort the shutdown by running the command shutdown /a. This will abort the shutdown process.
Furthermore, you can also specify the time frame after which the shutdown will take place. For this, you have to type in shutdown /s /t 120
Here 120 are seconds. This tells the command that shutdown the computer after 120 seconds. You can calculate seconds from minutes and put the time according to your need.
Restarting a computer is also very easy using cmd commands. Here is what you need to execute shutdown /r.
To specify the time of the restart use /t option followed by seconds as we used above.
Similarly, you can logoff your computer by typing the command shutdown /l and to hibernating the PC using the command shutdown /h. Just keep in mind that you can use the /t option with the logoff and the hibernate command to specify the time. These commands perform their respective actions instantly.
A-Z List Of Windows CMD Commands
Here is the list of all the command prompt commands that you try. Download the pdf below that contains all the cmd commands sorted in alphabetical order.
Rundown: CMD Commands Tricks And Hacks
This was all about CMD commands tricks and hacks. I hope you liked learning about command prompt commands. If you have any questions or suggestions please let me know in the comments.
Also, subscribe to notifications to get the latest updates.