Command Prompt(CMD) is a very powerful tool for Windows. It gives permission to users to perform various tasks like make directory, remove directory etc. In this article, We will learn many CMD commands which helps basic file management with the help of examples.
In windows, we do some tasks related to basic file management in our daily life by using mouse and keyboard. But windows command prompt provides some commands to do these tasks in efficient way & also important for developers.
DIR Command
It is use to display files and folders(directories) of current directory.
Syntax
dir
CD Command
It is use to change directory.
Syntax
cd directoryname
cls Command
It is use to clear cmd screen.
Syntax
cls
mkdir / md Command
Here both commands mkdir & md is use to make directory.
Example
mkdir test2
Here test2 is directory name, which we want to make.
md test3
Here test3 is directory name, which we want to make.
To check directory made or not, use dir command.
ren Command
It is use to rename file or directory.
Syntax
ren <old_directory_name> <new_directory_name>
ren test1 test5
Above command will change directory name from test1 to test5.
To change file name
ren test1.txt test3.txt
Above command will change file name from test1.txt to test3.txt.
move Command
It is use to move files from one place to another place.
Example
move test1.txt test3
Above command will move test1.txt file from current directory to test3 directory, when test3 directory presents in current directory. Suppose our current directory is “C:/example/test1/” and our files test1.txt is here & we have made a directory test3 here. then above command is fine.
But if test3 directory isĀ present in “C:/example/”, then we use below command to move file:
move test1.txt ../test3
del / erase Command
It is use to delete file or files.
Example
del test1.txt
Above command will delete “test1.txt” file from current directory.
erase test1.txt
Above command will also delete “test1.txt” file from current directory.
To delete all text files from current directory,
del *.txt
To delete all files from current directory,
del *.*
rmdir Command
It is use to remove directory, If it is empty.
Example
rmdir test3
Above command will remove test3 directory, If it is empty.
To remove multiple empty directory
rmdir test1 test2 test3 test4
Above command will remove all directories(test1, test2, test3, test4).
But if we want to remove directory, which is not empty, use below option
rmdir test4 /s
Above command will ask “Are you sure(y/n)”, press y. It will remove test4 directory.
takslist Command
It will display all tasks list, which is running in your system. Every task in your system is defined as process ID means PID.
Example
tasklist
If we want to kill any task, we use taskkill command with their process ID.
taskkill -pid 5392
Windows system management and troubleshooting are made possible with the use of CMD commands. Understanding these commands can help you operate your computer more effectively and efficiently, from simple file operations to complex system administration and network troubleshooting. You may automate operations, find quick fixes for problems, and learn more about the setup and performance of your system by implementing these commands into your everyday workflow.