50 CMD Command & Their Functions You Must Know

50 CMD Command and Their Functions You Must Know

Running CMD command in Command Prompt is an alternative way to operate Windows devices. With it, you can do various things. For example copying files or fixing errors on the hard drive.

However, you need to know what cmd commands can be used to do certain things. In this article, you will learn 50 CMD commands and their functions. Happy reading!

What Are CMD Commands?

What Are CMD Commands?
What Are CMD Commands?

Command Prompt or CMD is a command-line interpreter (CLI) application in the Windows operating system. The commands in CMD function to perform various operations on your computer.

Actually, these commands have been around since the MS-DOS era. However, ordinary Windows users have rarely used the CMD command because the same function is now more easily accessed via the menu.

However, CMD commands give more control over the operation of your computer. There are indeed many varieties. However, don’t worry. You can use the list in this article as a cheat sheet!

Complete List of CMD Commands and Their Functions

Before entering this list of CMD commands, you need to know that not all CMD commands can be used in all versions of Windows. To find out which basic CMD commands you can use, see the explanation below.

1. Append

Supported in: all versions except Windows 10

The append command allows you to open files that are in another directory, even when you are not in that directory. Examples of its use as below:

append c: \ docs; c: \ letters edit myfile.txt: \ docs ; c : \ edit myfile letters . txt

The purpose of this CMD command is to open and edit a file called myfile.txt. If the file is not in the directory you are opening, the CMD command will look for it in the c: \ docs and c: \ letters directories.

If you want to add more than one search directory, use a semicolon (;) to separate each directory.

2. arp

Supported on: all versions of Windows

As the name implies, the arp command is used to manage the ARP or address resolution protocol. ARP itself is part of the IP ( internet protocol ) that directs 32-bit IP addresses to MAC ( medium access control ) addresses.

Following is an example of using the arp command. For example, your IP address is 220.0.0.160. If you want to replace it, just run the following CMD command:

arp -s 220.0.0.161 00-50-04-62-F7-23- s 220.0 . 0161 00 – 50 – 04 – 62 – F7 – 23 

With this CMD command, your IP address will be replaced with 220.0.0.161.

3. Assoc

Supported in: all versions after Windows 98

The assoc command is used to check the file extension associated with a file type. For example, suppose you want to display a .txt extension. For that, you need to run the following CMD command. 

assoc .txt. txt

After you enter the command will appear writing. Txt = txt file, which means. Txt is an extension of text file types.

Besides, the assoc command can also be used to change or delete an associated file extension with the file type. Here is an example of using it to delete:

assoc .txt = . txt = 

If you want to use the above command, don’t forget to add a space after the equal sign (=).

4. at

Supported in: Windows 2000 and XP

This CMD command is used to automate various other CMD commands at the specified time. Although only supported on three older versions of Windows, at the same time it can also be used in Vista and 7 even though the status has been deprecated (no longer getting updates or support).

Starting in Windows 8, at has been replaced with schtasks which has a similar function. This CMD command will also be discussed later.

This CMD command itself has several uses. If you just type at, Command Prompt will display a list of automated commands.

Note that each of these CMD commands is represented by an ID number. This number is useful when you want to delete the command automation that is already registered.

For example, the command below will remove the command automation with ID 1:

at 1 / delete1 / delete 

If you want to delete everything, you can type the following command:

at / delete / yes/ delete / yes 

Now, let’s try making a command automation with the following example:

at 6:50 PM / every: 5,10,15,20,25 “c: \ winnt \ task.bat”6 : 50PM / every : 5 , 10 , 15 , 20 , 25 “c: \ winnt \ task.bat”  

In this example, your computer will automatically run the task.bat file at 6:50 p.m. every 5, 10, 15, 20, and 25. As a reminder, you can only use the date to determine the day of the automation implementation.

If / interactive is added after hours of implementation as in the example below, you will be able to interact with the file when it is run.

at 6:50 PM / interactive / every: 5,10,15,20,25 c: \ winnt \ beep.bat6 : 50PM / interactive / every : 5 , 10 , 15 , 20 , 25 c : \ winnt \ beep . bat 

5. Attrib

Supported on: all versions of Windows

Have you ever found an unwanted file, but you can’t delete it? Perhaps the file attribute is set to read-only.

To change its attributes, a common method is to right-click on the file, then open Properties. At the bottom of the Properties window you will find a checkbox to turn off or turn on the attribute.

CMD-COMMAND

However, you can also do it with the CMD Attrib command. For example, as shown below:

attrib -R example.txt- R example. txt

In that example, -R implies deleting the read-only attribute from the file in question. If you want to add an attribute, then the minus sign (-) is replaced by a plus sign (+).

Besides R, there are three other attributes that you can set with the attrib command:

  • H = hidden, to hide files and vice versa
  • S = system, indicating that a file is used for operating system requirements
  • A = archive, indicating that a file has never been backed up

6. bcdedit

Supported in: all versions after Windows XP

bcdedit is a command that allows you to do three things, namely managing the boot configuration data store, saving the configuration parameters, and managing the operating system boot.

The bcdedit command format is actually simple. Here is an example:

bcdedit / command <argument>/ command <argument>

/ command is a sub-command that can be used with bcdedit, while <argument> is the name of the file or directory the target of this command is.

Well, what makes bcdedit quite complicated is the number of sub-commands in it. Below are some of the sub-commands and their functions:

  • / createstore – creates a new boot configuration datastore
  • / create – creates a new entry in a boot configuration datastore
  • / deletevalue – removes an element from the boot entry
  • / bootdebug – activates the boot debugger in a boot entry or vice versa

To see the complete list of bcdedit sub-commands you can run the following command:

bcdedit /?/?

If you want to know the usefulness of a sub-command, you just need to add the name after the command, like this:

bcdedit /? creatore/? creatore

7. bootsect

Supported in: all versions after Windows 98

The bootsect command is used to update the master boot code in the hard drive partition. Thus, you can change the boot sequence manager type from NTLDR to BOOTMGR and vice versa.

For example, you need the CMD command below to change the master boot code for the partition: E on your computer:

bootsect / nt52 E:/ nt52 E :

8. break

Supported on: all versions of Windows

Depending on the settings, the ctrl + C key combination can be used to stop an MS-DOS process. For example a batch file.

Now, break is a command that is used to determine the settings. For example like this:

break off off

If you run the command, the ctrl + C key combination cannot be used to stop the MS-DOS process. If you only want to check this setting, just type “break”.

9. cacls

Supported in: all versions after Windows 98

The cacls command is used to check or change a file’s access control list (ACL). ACL itself is a list of access control entries (ACE). This list is used to determine file access owned by a user on a computer.

Syntax cacls is quite simple, as you can see below:

cacls [file name] [sub-command][ file name ] [ sub – command ] 

Several cacls sub-commands can be used, namely:

  • / T – replaces ACLs from files specified in a directory and all sub-directories within it
  • / E – like the previous sub-command, but serves to change the contents of the ACL
  • / G user: perm – gives permissions to a user
  • / R user – removes permission from a user
  • / P user: perm – changes a user’s permission
  • / D user – removes file access from a user

To fill perm, there are four codes that you can use:

  • n – none (no access)
  • r – read (open file)
  • w – write (change file)
  • f – full control (full access)

For example, the code below is executed if you want to give full access to the user named user1 for the myfile.txt file:

cacls myfile.txt / e / g user1: f. txt / e / g user1 : f

If you just want to know the ACL of a file, you don’t need to add sub-commands.

10. call

Supported on: all versions of Windows

The CMD call command is used to run a batch file within each other. For example, the CMD command below will run the second.bat file in the currently running batch file :

call second.bat. bat

Also Read : 60+ Best Secret Codes To Explore Android 2020

11. change

Supported in: all versions after Windows XP

As the name suggests, the change command functions to change the remote desktop (RD) session host server settings for the login status, COM port mapping, and installation mode. The syntax for each of these uses is different. Therefore, we will discuss them one by one.

change logon

The change logon command sets the logon status in the client session. For example, you can allow logon by changing its status to enabled, as below:

change logon / enable/ enable

Conversely, if you want to prevent logon, use the following command:

change logon / disable/ disable

To just check the status, run this command:

change logon/query/ query

change port

You will need the change port command when you want to change COM port mapping. For example, running the following command will replace COM12 to COM1:

change port com12 = com1= com1

change user

As we mentioned before, change the user is used to change the RD session host server installation mode. Examples of uses are as follows:

change user / execute/ execute

The above command allows the mapping of .ini files to the main directory. However, this means you cannot install any application on the RD session host server. To allow this, use this command:

change user / install/ install

12. chdir

Supported on: all versions of Windows

Want to use the CMD command to navigate directories? Can! You just use chdir. With this CMD command, you can return to the directory that was opened previously with the command as below:

chdir ….

If the command is executed, the effect will be like when you click the back button in File Explorer.

Besides, chdir can also be used to return to the main directory. For example like this:

chdir \

With this command, from the C: \ Windows \ COMMAND> directory, you can jump to C: \ in an instant.

Interestingly, you can open a directory by just typing in its name. For example:

chdir \ windows \ system32

By executing that command, the system32 directory is immediately accessed.

For the record, you can also replace chdir with cd. Both of these commands have the same function and syntax.

13. chkdsk

Supported on: all versions of Windows

Is your laptop or computer slow? As a first checking step, you can run the chkdsk CMD command. This command serves to check the status of your hard drive. 

Besides, chkdsk can also be used to try to correct hard drives that have errors due to bad sectors. Just run the following cmd command:

chkdsk d: / r: / r 

14. chkntfs

Supported in: all versions after Windows 98

The chkntfs function is related to chkdsk. With it, you can order the computer to check all hard drive partitions and run chkdsk on partitions that are considered problematic. The command is as follows:

chkntfs / d/ d

15. cipher

Supported in: all versions after Windows 98

The cipher command is closely related to file and folder encryption on NTFS type hard drives. There are three main functions that you can use from this CMD command.

First, you can check the encryption status of a file or folder with the command below:

cipher / c myfile.txt/ c myfile . txt

Second, you can encrypt a file or folder by replacing / c with / e, as in the following example:

cipher / e myfile.txt/ e myfile . txt

Third, the cipher command allows you to turn off file or folder encryption with the / d sub-command:

cipher / d myfile.txt/ d myfile . txt

16. clip

Supported in: all versions after Windows XP

The clip command is used when you want to copy the output of a CLI to the clipboard for one reason or another. The syntax is very simple; just type the clip in the Command Prompt and write the name and file extension that you want to copy. For example like this:

clip readme.txt. txt

17. cls

Supported on: all versions of Windows

For those of you who use CMD Command Prompt for various purposes, the cls command is very useful. By running this CMD command, you can delete all the text in CMD, both the one you typed and the output.

Like clips, you just type cls to use this CMD command.

18. cmdkey

Supported in: all versions after Windows XP

cmdkey is used to create, delete, or view the username and password used to log in to the computer. This CMD command is useful if you are the admin user of the computer.

Its use is simple. If you want to see a list of usernames and passwords of computer users, type:

cmdkey / list/ list

Now let’s try to register a username and password with the following CMD command:

cmdkey / add: server01 / user: new / pass: pf90/ add : server01 / user : new / pass : pf90

With that, you have created access for a user named userbaru with a pf90 password to enter server01.

If you want to delete it, just use this CMD command:

cmdkey / delete: new/ delete : userbaru

You can also empty the list of usernames and passwords on a server:

cmdkey / delete: server01/ delete : server01

19. color

Supported in: all versions after Windows 2000

Bored with the black and white appearance of Command Prompt? You can change the color with the color command. The syntax is like this:

color <b> <f><b> <f>

<b> specify the background color, while <f> determines the color of the text. To determine the color, you use the numbers from 0 to 9. However, you cannot choose the same color. Here are the colors you can choose and the numbers that represent them:

  • 0 black
  • 1 blue
  • 2 green
  • 3 aqua
  • 4 red
  • 5 purple
  • 6 yellow
  • 7 white
  • 8 gray
  • 9 light blue

Besides, there are six more colors to choose from. However, all six are represented by letters. Here’s the list:

  • a light green
  • b young aqua
  • c pink
  • d light purple
  • e light yellow
  • f bright white

For example, with the following CMD command the Command Prompt background will turn gray with red text:

color 8484

If you want to return the Command Prompt to its original color, just type the color without any additions.

20. comp

Supported in: all versions after Windows 98

The comp command is used to compare two files. Usually, this CMD command is used when you want to check the code of the two files. For example like this:

comp file1.txt file2.txt / n = 10 / a. txt file2. txt / n = 10 / a 

With the above CMD command, you compare file1.txt and file2.txt.

/ n specifies the number of lines of code that are checked with the comp command. In this example we compare the first ten lines of code, but you can replace them as desired.

/ a is used to display the output of the comp command in the ASCII character set. The results are as follows:

Compare errors at LINE 5error at LINE 5

file1 = i= i

file2 = o= o

Compare errors at LINE 5error at LINE 5

file1 = v= v

file2 = u= u

Compare errors at LINE 5error at LINE 5

file1 = e= e

file2 = r= r

Compare errors at LINE 6error at LINE 6

file1 = s= s

file2 = f= f

Compare errors at LINE 6error at LINE 6

file1 = x= x

file2 = v= v

Compare errors at LINE 6error at LINE 6

file1 ==

file2 = e= e

Compare errors at LINE 7error at LINE 7

file1 ==

file2 ==

Compare errors at LINE 7error at LINE 7

file1 ==

file2 ==

Compare errors at LINE 8error at LINE 8

file1 ==

file2 = s= s

File1 only has 7 linesonly has 7 lines

Also Read: Recover Deleted Files On Android in 2020 Easily

21. compact

Supported in: all versions after Windows 2000

Earlier you have learned file encryption with cipher. Now we will discuss the CMD commands used to compress compact files. However, you need to remember that this CMD command only works on NTFS type partitions.

For starters, maybe you want to check the compression status of each file in a directory. The following CMD command example allows you to check all files in the directory being accessed:

compact

If there is a file you want to compress, the command looks like this:

compact file.txt / c. txt / c

For the opposite, you just replace / c with / u. For the record, compressing or decompressing a file will mark the directory where it is stored. Once marked, all files stored in that directory will be compressed or decompressed.

22. convert

Supported in: all versions after Windows 98

As the name suggests, the convert command is used when you want to change a FAT-type partition to NTFS. For example like the following example:

convert d: / fs: ntfs: / fs : ntfs 

23. copy

Supported on: all versions of Windows

The use of copy CMD commands is the same as the name, which is to copy a file to a different location. To understand its usefulness, consider the example below:

copy myfile.txt d: \. txt d : \

This CMD command implies copying the myfile.txt file in the directory that you are currently accessing to the D: directory.

You can also use the copy command to copy all files of the same type. To do this, use the asterisk (*) as in this example:

copy * .txt d: \* txt d : \

In fact, the copy CMD command can also be used to copy all files in one directory, as in the following example:

copy *. * f: \*. * f : \

Of course this command is useful if you want to copy files to a removable drive such as a flash drive.

24. date

Supported on: all versions of Windows

The date command is used to view the date or replace it. The syntax is very simple. After typing “date”, the Command Prompt will display today’s date and questions to change the date. If you do not want to replace it, you just press the enter key on the keyboard.

25. Defrag

Supported on: all versions of Windows

If you are diligent in optimizing your hard drive, perhaps you are already familiar with the Disk Defragmentation feature. Even in Command Prompt you can do this with the CMD defrag command.

To just do defragmentation, you just run this CMD command:

defrag c::

If you want to analyze the partitions first, add / a as in the following example:

defrag c: / a: / a 

Besides, you can also do defragmentation of all partitions:that , you can also do : 

defrag / c/ c

26. del

Supported on: all versions of Windows

You can use the Command Prompt to delete files with the del command. Let’s look at the following examples to understand their use.

To delete a file from the directory being accessed, use the following CMD command:

del myfile.txtmyfile . txt

Files deleted with this CMD command will enter the Recycle Bin as usual. However, you might want to display a confirmation question before the selected file is actually deleted. If yes, add / p as in the example below:

del myfile.txt / pmyfile . txt / p

Do you have to access the directory for the file you want to delete? Of course not. You can do this from another directory with this CMD command:

del c: \ windows \ test.tmpc : \ windows \ test.tmp

You can even delete all files in a directory with the following command:

del c: \ windows \ temp \ *. *c : \ windows \ temp \ * . *

Interestingly, the del command gives you capabilities that you cannot have if you use File Explorer, which is deleting files with the read-only attribute. You do this by adding / f after the file name:

del myfile.txt / fmyfile.txt / f

As a reminder, you can replace the del command with delete or erase because all three have the same function.

27. deltree

Supported in: Windows 95, 98, and ME

If files deleted with the del, delete, and erase commands enter the Recycle Bin, the deltree command is different. This CMD command serves to delete files permanently. Not only that, deltree can also delete all sub-directories in a directory.

Examples of their use are as follows:

deltree d: \ pictures: \ pictures

With the above command, the directory named pictures on the D: partition and all of its sub-directories will be permanently deleted.

28. dir

Supported on: all versions of Windows

The dir command is useful for viewing a list of files and sub-directories that are in a directory. Besides, this CMD command is also used to display various information about your hard drive, including:

  • Serial number
  • The number of files that are on the hard drive
  • Total file size
  • Remaining space on the hard drive

Let’s discuss the syntax for each function. If you just want to display a list of files and sub-directories in the directory being accessed, type “dir”.

This CMD command can be made more flexible to show files with certain extensions only, as in the following example:

dir * .txt * .doc* txt *. doc

With the above CMD command, Command Prompt will only display .txt and .doc files in your directory.

The use of the dir command is also inseparable from the file attribute. The following is a list of attributes and symbols in the dir command syntax:

  • d – directory
  • r – file read only
  • h – hidden files ( hidden )
  • a – files that have not been archived or backed up
  • s – file system
  • i – indexed file

Examples of use like this:

dir / a: r/ a : r

With the above command, only files with the read only attribute will be displayed .

29. diskpart

Supported in: all versions after Windows 98

The diskpart command is used to manage the hard drive partition on your computer or laptop. With it, you can create new partitions, delete them, and display a list of existing partitions.

To use it, type “diskpart” first. After that, type “list disk” to display the list of hard drives on the computer. Below is an example of the output:

 Disk ### Status Size Free Dyn GptDisk ### Status Size Free Dyn Gpt

Disk 0 Online 476 GB 449 MBDisk 0 Online 476 GB 449 MB               

  Disk 1 Online 2047 GB 0 BDisk 1 Online 2047 GB 0 B              

  Disk 2 Media No 0 B 0 BDisk 2 Media No 0 B 0 B                 

  Disk 3 Media Number 0 B 0 BDisk 3 Media Number 0 B 0 B                 

  Disk 4 Media Number 0 B 0 BDisk 4 Media Number 0 B 0 B                 

  Disk 5 Media Number 0 B 0 BDisk 5 Media Number 0 B 0 B                 

For example, you want to manage partitions on disk 0. To select it, type “select disk 0”. Next type “list partition” to see the list of partitions in it. Example of the output as below:

Partition ### Type Size Offset ### Type Size Offset

————- —————- ——- ——————– —————- ——- ——-      

  Partition 1 Primary 549 MB 1024 KBPartition 1 Primary 549 MB 1024 KB                 

  Primary Partition 2 195 GB 550MBPartition 2 Primary 195 GB 550 MB                 

  Partition 0 Extended 269 GB 195 GBPartition 0 Extended 269 GB 195 GB                

  Partition 4 Logical 29 GB 195 GBPartition 4 Logical 29 GB 195 GB                  

  Partition 5 Logical 29 GB 225 GBPartition 5 Logical 29 GB 225 GB                  

  Partition 6 Logical 8 GB 254 GBPartition 6 Logical 8 GB 254 GB                   

  Logical Partition 7 202 GB 262 GBLogical Partition 7 202 GB 262 GB                 

  Partition 3 Recovery 502MB 465GBPartition 3 Recovery 502 MB 465 GB                

Now, you can choose the partition you want to manage. For example, type “select partition 1”. At this point, you can utilize various sub-commands supported by diskpart. Here are some of them that are often used:

add

The add sub-command functions to create a new partition that is similar to another partition that is already on your computer. Examples of their use are as follows:

add disk = 1disk = 1

With these sub-commands, a new partition with the same settings as partition number 1 will be created.

assign

If you use to add a disk, the new partition created does not yet have letters. The assigned sub-command is used to determine the letter. However, don’t forget to use the select partition command first to select the partition you want to give letters.

In the example below, the letter E: is given to the selected partition:

assign letter = e= e

delete

As the name implies, this sub-command is used to delete a partition. Here is an example of its use:

delete partition partition

details

With detailed sub-commands, you can see information about the selected partition. Type “detail partition” and you will see the following output:

Partition 1 1

Type: 07 : 07 

Hidden: No.: No. 

Active: Yes: Yes 

Offset in Bytes: 1048576 in Bytes : 1048576 

Volume ### Ltr Label Fs Type Size Status InfoVolume ### Ltr Label Fs Type Size Status Info 

———- — ———– —– ———- ——- —- —– —————— — ———– —– ———- ——- —- —– ——–              

* Volume 0 System Rese NTFS Partition 549 MB Healthy System Volume 0 System Rese NTFS Partition 549 MB Healthy System                   

29. driverquery

Supported in: all versions after Windows XP

Driverquery CMD command is used to display a list of drivers that be installed on your computer or laptop. Examples of output are as follows:

Module Name Display Name Driver Type Link Date Name Display Name Driver Type Link Date                   

============ ====================== ============= === =================== ====================== ============= =============== =======  

PptpMiniport WAN Miniport (PPTP) Kernel 7/15/2016 8:28:13 PMWAN Miniport ( PPTP ) Kernel 7 / 15 / , 2016 8 : 28 : 13 PM              

Processor Processor Driver Kernel 7/15/2016 8:10:42 PM Processor Driver Kernel 7 / 15 / , 2016 8 : 10 : 42 PM                 

Psched QoS Packet Scheduler Kernel 7/15/2016 8:25:21 PM QoS Packet Scheduler Kernel 7 / 15 / , 2016 8 : 25 : 21 PM              

QWAVEdrv QWAVE Driver Kernel 7/15/2016 8:28:46 PM QWAVE driver Kernel 7 / 15 / , 2016 8 : 28 : 46 PM         

RasAcd Remote Access Auto Con Kernel 7/15/2016 8:29:11 PM Remote Access Auto Con Kernel 7 / 15 / , 2016 8 : 29 : 11 PM             

RasAgileVpn WAN Miniport (IKEv2) Kernel 7/15/2016 8:27:00 PM WAN Miniport ( IKEv2 ) Kernel 7 / 15 / , 2016 8 : 27 : 00 PM             

Rasl2tp WAN Miniport (L2TP) Kernel 7/15/2016 8:27:35 PM WAN Miniport ( L2TP ) Kernel 7 / 15 / , 2016 8 : 27 : 35 PM              

RasPppoe Remote Access PPPOE Dr. Kernel 7/15/2016 8:28:21 PM Remote Access PPPOE Dr Kernel 7 / 15 / , 2016 8 : 28 : 21 PM           

RasSstp WAN Miniport (SSTP) Kernel 7/15/2016 8:27:11 PM WAN Miniport ( SSTP ) Kernel 7 / 15 / , 2016 8 : 27 : 11 PM              

30. edit

Supported on: all versions up to Windows 7 but not supported on 64-bit systems

Command Prompt actually has a built-in text editor tool. To access it, you just run the CMD edit command. For example, as shown below:

edit c : \ myfile . txt

The CMD command will open a file called myfile.txt. If the file does not exist, the tool will automatically create a new file with the name you specify.

Also Read: /data, /recovery, /system… These are all the memory partitions on your Android

31. exit

Supported on: all versions of Windows

The exit CMD command is used to exit the Command Prompt or close the running batch script process . To run it, you only need to type “exit”.

32. expand

Supported in: all versions after Windows 98

Previously you have recognized the compact command that is used to compress files. Well, expand is the opposite. This command functions to decompress. The syntax is quite simple:

expand <source> <destination> 

<source> is where the file you want to open is, while <destination> is the directory where you want to put the contents of the file. Examples of their use are as follows:

expand d : \ i 386 \ p . dl_ c : \ windows \ system32 \ hall . etc

33. find

Supported on: all versions of Windows

Command Prompt allows you to search for specific text in a file with the find command. The syntax is like this:

find [ string ] [ drive \ file name ] 

For example, you want to find the text “REM” in the autoexec.bat file located on drive C :. Then you need to run the following command:

find “REM” c : \ autoexec . bat

Note that the find command will search for text that matches what you type. Therefore, you need to pay attention to the use of capital letters.

For example, this command will not display the text “brake” in lowercase letters in your search results.

However, you can also ask the command to not care about the typeface. To do this, you just need to add / I before the text that is searched.

34. ipconfig

Supported on: all versions of Windows

ipconfig is a CMD command that is used to display information about network settings that are specified for your computer or laptop.

By typing “ipconfig” in the Command Prompt, you can already see that information, like the following example:

Connection – specific DNS Suffix . : hsd1 . ut . comcast . net .   

IP Address . . . . . . . . . . . . : 192.168 . 201,245             

Subnet Mask . . . . . . . . . . . : 255,255 . 255.0              

Default Gateway . . . . . . . . . : 192.168 . 201.1            

However, you can also see the full information by adding “/ all” behind the command. The result will be like this:

Host Name . . . . . . . . . : COMPUTERH1           

DNS Servers . . . . . . . . : 123.45 . 67.8          

111,111 . 111.1

111,111 . 111.1

Node type . . . . . . . . . : Broadcast          

NetBIOS Scope ID . . . . . . :       

IP Routing Enabled . . . . . : No.       

WINS Proxy Enabled . . . . . : No.       

NetBIOS Resolution Uses DNS : No   

0 Ethernet adapter : 

Description . . . . . . . . : PPP Adapter .         

Physical Address . . . . . . : 44 – 44 – 44 – 54 – 00 – 00        

DHCP Enabled . . . . . . . . : Yes         

IP Address . . . . . . . . . : 123.45 . 67.12          

Subnet Mask . . . . . . . . : 255,255 . 0.0           

Default Gateway . . . . . . : 123.45 . 67.8         

DHCP Server . . . . . . . . : 255,255 . 255,255          

Primary WINS Server . . . . :     

Secondary WINS Server . . . :    

Obtained Lease . . . . . . . : 01 01 80 12 : 00 : 00 AM            

Lease Expires . . . . . . . : 01 01 80 12 : 00 : 00 AM             

1 Ethernet adapter : 

Description . . . . . . . . : 3Com 3C90x Ethernet Adapter             

Physical Address . . . . . . : 00 – 50 – 04 – 62 – F7 – 23        

DHCP Enabled . . . . . . . . : Yes         

IP Address . . . . . . . . . : 111,111 . 111,108          

Subnet Mask . . . . . . . . : 255,255 . 255.0           

Default Gateway . . . . . . : 111,111 . 111.1         

DHCP Server . . . . . . . . : 111,111 . 111.1          

Primary WINS Server . . . . :     

Secondary WINS Server . . . :    

Obtained Lease . . . . . . . : 11 16 00 12 : 12 : 44 AM            

Lease Expires . . . . . . . :         

Apart from displaying your network settings, the ipconfig CMD command also has other uses if used with its sub-commands. Here are some of the sub-commands that are used in general:

  • / release – removes DHCP settings and IP addresses for all network adapters used. You can also type in the adapter name to use ipconfig / release for the adapter only
  • / renew – updates DHCP settings and IP addresses for all network adapters used. Like the previous sub-commands, you can also use ipconfig / renew on the selected adapter
  • / flushdns – clears the DNS cache stored on your computer. This needs to be done regularly so that you can still access the sites that you normally visit

35. logoff

Supported in: all versions after Windows 98

As the name implies, the logoff command is used to log off from your computer. In the context of local computer networks, this CMD command can also be used to stop certain user sessions.

To run it, you just type “logoff”. If you are an administrator, you can stop a user’s session by adding the computer ID, as in the following example:

logoff 12

36. move

Supported on: all versions of Windows

The move CMD command allows you to move one or more files to another directory. In fact, you can use it to move one directory into another directory too. The syntax is as follows:

move < file name > <destination> 

For example like this:

move stats. doc c: \ statistics

If you are not in the file directory, you need to specify the partition letter and directory name:

move d : \ docs \ stats . doc c: \ statistics

If you want to move more than one file, you must separate each with commas and spaces:

move stats. doc , morestats. doc c: \ statistics

Now, to move a directory into another directory, you need to add double quotes at the beginning and end of the directory name:

move “directory1” directory2

37. msg

Supported in: all versions after Windows 2000

If you are on a local computer network, you can send messages to other users with the msg command. The syntax is like this:

msg <username> <message> 

Below is an example if you send a message that says “Hello” to a user named “user01”:

msg user01 Hello

38. pause

Supported on: all versions of Windows

The pause CMD command is used to stop a batch file that is currently running. If you get, the message “Press any key to continue” will appear on the screen. To continue the filing process, you just press any key on the keyboard.

39. print

Supported on: all versions of Windows

Maybe you don’t know yet that you can print a text file from the Command Prompt. To do this, you need to name the file (filename) and the printer port used (device), as in the following syntax:

print <filename> <device>  

However, you need to know the type of port used by your printer. For parallel ports, the name of the printer used starts with LPT. As for the serial port, the printer name starts with COM. For clarity, let’s consider the example below:

print c : \ file . txt / d : lpt1

By running the example CMD command, you will print file.txt that is in partition C: with the printer on the LPT1 port.

40. query

Supported in: all versions after Windows XP

A query is a CMD command that is used to display four types of information related to the RD session host server. Each information can be indicated by the following syntax:

  • query process – displays a list of processes running on the RD session host server
  • query session – displays a list of sessions in the RD session host server
  • query term server – displays a list of RD session host servers that are on the local network
  • user query – displays information about the user’s session on an RD session host server

Also Read: UEFI & Bios: Solve Issues & Update in 8 easy steps

41. recover

Supported in: all versions after Windows 98

If the hard drive is damaged, you can try to restore the data on it with the recover command.

However, you can only recover files one at a time. In addition, you must know the name of the file and its location. For example, as shown below:

recover d : \ fiction \ story . txt

42. rename

Supported on: all versions of Windows

As the name implies, the rename command is used to change file and directory names. Like the previous command, rename requires you to specify the directory name of the selected file or directory.

For example, with the command below you can change the file “computer.jpg” to “text.jpg”:

rename d : / pictures / computer . jpg text . jpg

For the record, you can also use the ren command to rename files or directories. The syntax command is no different from the rename command.

43. repair-bde

Supported on: Windows 7, 8 and 10

repair-bde is also a CMD command that works to save files from a damaged hard drive . However, it is used for hard drives that are encrypted with BitLocker.

To be able to use repair-bde, you must have another hard drive on the computer. This is used as a storage place for files from damaged hard drives .

Data on the second hard drive will be overwritten or overwritten with files that can be saved from the damaged hard drive . Therefore, it is recommended that you use an empty hard drive .

In addition, you need a recovery key , recovery key package , recovery password, or password to unlock encryption on the hard drive .

Given the number of factors involved, repair-bde does sound complicated. However, the syntax is quite easy to understand:

repair – bde <inputvolume> <outputvolume> <- rk > <- rp > <- pw > <- kp >     

Following is an explanation of each part of the syntax above:

  • inputvolume – the letter of the hard drive partition whose files you want to save
  • outputvolume – the hard drive partition letter that will be used to store these files
  • -rk – file recovery key from the encrypted hard drive
  • -rp – password recovery to open the encrypted hard drive
  • -pw – password to open the encrypted hard drive
  • -kp – recovery key package to open an encrypted hard drive

Even though -rk is a file, you have to list the partition letters and the directory that they are in.

For clarity, let’s look at an example of using the repair-bde CMD command below:

repair – bde c : d : – rk f : \ RecoveryKey . defender 

The command will try to move files from drive C: to drive D: with a recovery key file named RecoveryKey.bek.

For the use of the repair-bde command that uses the recovery key package , the examples are as follows:

repair – bde C : D : – rp 111111 – 222222 – 333333 – 444444 – 555555 – 666666 – 777777 – 888888 

44. replace

Supported on: all versions of Windows

The replace CMD command is used to replace one or more files in a directory with other files. This CMD command is useful if there are the same file in several directories and needs to be updated regularly.

The syntax is like this:

replace <drive1> <filename> <drive2> < /p> </ r > </ s >    

As you can see above, there are three options that can be used in the replace command, namely:

  • / p – displays a confirmation question before you replace files on <drive2>
  • / r – used to replace files with the read only attribute
  • / s – used to replace all files in a subdirectory in <drive2>

Let’s look at an example of its use below:

replace f : \ phones . cli c : \ / s

With this command, all files “phones.cli” in partition C: and all subdirectories will be replaced with files that are in the partition F :.

45. rmdir

Supported on: all versions of Windows

rmdir is used to delete empty directories. However, this CMD command can also delete non-empty directories in Windows XP and later versions.

Simple use like this:

rmdir c : \ test

If you want to delete files and subdirectories in it, you just need to add / s behind the above command:

rmdir c : \ test / s

You can also use the rd command to delete a directory because it has the same function as rmdir.

46. ​​robocopy

Supported in: all versions after Windows XP

Previously you have learned about copy commands. robocopy has the same function, but this command can also copy directories and partitions.

The syntax is similar to the copy command. The difference is that the file you want to copy to the destination directory is listed after you mention the name of the directory:

robocopy <source> <destination> < file ( s )> <option>   

As can be seen above, after mentioning the file you wish to copy, you can use one or several options. Here are some options that can be used:

  • / s – copy the subdirectories that are in the source directory, unless the subdirectories are empty
  • / e – copy the subdirectories that are in the original directory, whether there is content or not
  • / copyall – file information that is copied remains saved when it has been copied to the destination directory
  • / nocopy – copied file information is not saved when it has been copied to the destination directory
  • / move – delete the original file after copying
  • / a – only copies files with the archive attribute
  • / a +: <attribute> – copy and specify file attributes. The attribute symbol as mentioned earlier in the discussion about the Attrib command
  • / a-: <attribute> – like the previous option, but it also removes file attributes
  • / ia: <attribute> – only copies files with the attributes you specify
  • / xa: <attribute> – excludes files with the attributes you specify
  • / xf file <filename> – excludes files whose names have certain words
  • / xf dirs <directoryname> – excludes directories whose names have certain words
  • / max: n – only copy files below the size you specify (n)
  • / min: n – only copy files above the size you specify (n)

47. schtasks

Supported in: all versions after Windows XP

At the beginning of this article you have learned about the commands used to automate actions. Well, schtasks has the same function, but the syntax is different:

schtasks / <arguments> parameter

The meaning / parameter in schtasks is the sub-command. Here are some of them:

  • / create – create an automation
  • / delete – removes an automation
  • / query – displays a list of commands that are automated
  • / change – change the settings for an automation
  • / run – runs an automation
  • / end – stop an automation that is running

Whereas <arguments> are actions that are automated with schtasks. There are many actions you can take with the order. Below are some of the common <arguments>:

  • / tr – specifies the name of the file you want to run with schtasks and their directories
  • / tn – specify the name of the automated action
  • / sc – determines the frequency of automation. You can specify it per minute, hour, day, week and month. You can even make automation that only runs once.
  • / mo – specify the frequency in more detail. For example, say you want to run a file every 120 minutes.
  • / d – specify the day of automation
  • / m – specify the month of automation
  • / i – defines the time between automation of an action
  • / st – specifies when the automation starts. You need to remember that the format used is 24 hours. So, if you want to set an action for 2pm, then type 14:00.
  • / et – specifies when the automation stops
  • / k – removes the automation when it stops

So you can understand it more easily, let’s look at the example below. The following example is used to create an automation named SecurityScript with the target file sec.vbs:

schtasks / create / tn “Security Script” / tr sec . vbs / sc minute / mo 100 / st 17 : 00 / et 08 : 00 / k    

48. sfc

Supported in: all versions after Windows 98

The sfc or system file checker CMD command is used to find and replace Windows system files with the correct version. This is very useful if there are problems in your computer system that are difficult to fix.

The syntax is quite easy to understand:

sfc / command

/ command is a sub-command that can be used with sfc. Here is a list of sub-commands:

  • / scannow – find and repair damaged system files
  • / verifyonly – looks for corrupted system files
  • / scanfile – scans for damage to the selected file and fixes it. You need to name the file and its directory to use this sub-command
  • / verifyfile – scans for damage to the selected file. As in the previous sub-command, you need to name the file and its directory

Below is an example of using the sfc command to scan for damage to the kernel32.dll file and repair it:

sfc / VERIFYFILE = c : \ windows \ system32 \ kernel32 . etc

49. shadow

Supported on: Windows XP, Vista and 7

The shadow command can be used if you manage the RD session host server . With it, you can control other computers on the server. Here is the syntax:

shadow {< SessionName > | < SessionID >} [/ server : < ServerName >] [/ v ]    

So, you can control a computer on the RD session host server by just mentioning the session name or ID. For example in the following example:

shadow 93

With these commands, you will control the computer with ID 93.

50. shutdown

Supported in: all versions after Windows 2000

If you want to shut down , sleep , or log off the computer from the Command Prompt, you can use the shutdown command. Apart from that, you can also use it to do the same thing on other computers on a network.

The syntax is simple, but there are several arguments you can use with this CMD command:

shutdown <arguments> < TargetComputer > 

Here are some of the arguments or sub-commands that are often used:

  • / i – displays the graphical user interface or GUI shutdown
  • / l – log off from the computer
  • / s – shut down or turn off the computer
  • / r – restart the computer
  • / a – cancel computer shut down
  • / p – turn off the computer on the local network directly. This means that the computer’s shutdown GUI that you normally see will not be displayed
  • / h – turn on hibernate mode
  • / t – the amount of time specified before a sub-command is executed

So, if you want to turn off your personal computer, you can run the following CMD command:

shutdown / i / s

However, if you manage a local network and want to turn off one of the computers, below are examples of the CMD commands needed:

shutdown / i / s / t 45

CMD Commands Conclusion

After reading this article, of course you know that there are tons of CMD commands that can be used. Its functions also vary, from basic operations such as copying and moving files to managing computers on the local network.

From now on you can use the CMD commands in this article to use the Command Prompt. If you have questions, feel free to leave it in comments box below.

Thank you for Reading.

Similar Posts

Leave a Reply

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