Top 50 Most Used Commands on Command Prompt with Examples

Most of us rely on the Graphical User Interface (GUI) as it’s more convenient than memorizing the traditional command lines. But one thing is certain—you can’t perform every task in the Windows GUI, and that’s when Command Prompt can be at your service.

This built-in command line interface can produce immediate outputs using simple commands with fewer computer resources. This way, you do not have to navigate through different windows just to get a single task done. With this program, you can perform advanced administrative functions or troubleshoot different Windows issues on your own!

In this article, I will discuss 50 commands you must know to master Command Prompt. But if you’re relatively new to this utility, I advise checking our beginner’s guide first.

50 Most Used Commands on Command Prompt (With Examples)

Basic Commands

Before deep diving into the major commands, I’ll start with the basic ones. Whether you’re planning to use Command Prompt extensively or just for general purposes, these are going to be useful.

CommandFunction
clsClears the Command Prompt screen
exitQuits Command Prompt
helpProvides help with a certain command
cdMoves you from one directory/drive to another
clipCopies the content to Windows Clipboard
verDisplays your present Windows version

CLS

cls

This command simply clears the Command Prompt screen. If you feel to clear up the working space after executing too many commands, it can be extremely helpful. All you have to do is type cls and hit Enter.

Syntax: cls

Exit

exit

If you’re planning to close the Command Prompt application, you do not require moving the cursor to press the Close button. Simply run the exit command and the program quits.

You can also use the /b parameter to exit from the loaded batch script. This way, the main window remains open and only the batch file is exited. However, if you use the parameter outside the script, it will close the CMD app.

Syntax: exit /b [error code]
where error code specifies a certain number

Help

help

This command comes in handy if you come across any command and wish to know its function. It provides you with the syntax along with the different parameters (switches).

If you simply execute help, it displays a list of the common commands used in Command Prompt.

Syntax: help

help-command

However, not all commands support this utility. In that case, you may use the /? parameter and this should work for every command.

Syntax: /?

alternative-help-command

CD or CHDIR

cd

It simply means ‘Change Directory’ and as the name suggests, it switches you from the current directory based on the specified path.

If you simply execute cd, it will just display the name of your current directory. Therefore, it’s important to learn the different parameters along with their functions and syntax:

ParametersFunctionsSyntax
<drivename>:Displays the drive along with the last directory locationcd <drivename>:
<path>:Takes you to the directory as per the specified locationcd <path>:
/dChanges directorycd /d [drivename]:
..Takes you to the previous/root directorycd..

Note: chdir and cd commands perform the same actions. So, you may change directory using any preferred option.

Clip

clip

This command copies the output executed from a certain command into the Windows clipboard. In this way, you can directly copy the data into any other program.

It’s extremely useful to directly copy the text or script files without opening them. Here are the parameters associated with it:

ParametersFunctionsSyntax
<command>Copies the output of a certain command to the Windows clipboard<command> | clip
<filename>Copies the content of a certain fileclip < filename

Ver

ver

Command Prompt offers the quickest way to view the version number of Windows using a simple command. This way, you can determine whether the latest Windows version is installed on your computer.

Syntax: ver

System Commands

Whether you’re trying to learn about your computer or perform some system-related tasks, the following commands can come in handy:

CommandFunction
powercfgControls power system settings
shutdownLogs off, restarts, or shuts down your computer
driverqueryDisplays all the installed drivers
hostnameDisplays the name of the computer’s host
systeminfoDisplays detailed information about your system

Powercfg

powercfg-l

This Command Prompt utility allows you to control the overall power settings of your computer. Note that if you use it without the appropriate parameters, you’ll encounter an “Invalid parameters” error. 

While there are plenty of parameters available, I’m only going to discuss the most common ones below. If you want to learn more, simply execute powercfg /?

ParametersFunctionsSyntax
/list or /lDisplays all the available power schemespowercfg /list or powercfg /l
/deletesettingDelete a specific power settingpowercfg /deletesetting <sub_guid> <setting_guid>
/setactiveMakes a scheme activepowercfg /setactive <scheme_guid>
/getactiveschemeFetches your current power schemepowercfg /getactivescheme
/hibernate or /hUsed to enable/disable hibernationpowercfg /hibernate [parameter]
/availablesleepstates or /aDisplays the available sleep states on your computerpowercfg /availablesleepstates or powercfg /a
/devicequeryDisplays those devices that meet the specified criteria (query flag)powercfg /devicequery <queryflag>
/deviceenablewakeAllows the specified device to wake the computer from sleeppowercfg /deviceenablewake <devicename>
/devicedisablewakeDisables the device to wake the computer from sleeppowercfg /devicedisablewake <devicename>
/lastwakeDisplays the activity that last woke your system from sleeppowercfg /lastwake

To learn the above commands in detail, I recommend executing the powercfg /? <parameter> command.

See also  Beginner's Guide: How to Use Command Prompt Effectively

For example, if you wish to know more about the /list parameter, you can execute powercfg /list.

Shutdown

shutdown

Interestingly, you can turn off your computer using a single command on Command Prompt. Also, it’s possible to schedule the shutdown process as you desire.

Here are some common parameters that might be useful:

ParametersFunctionsSyntax
/iOpens up the Remote Shutdown dialogueshutdown /i
/lLogs you outshutdown /l
/rRestarts your computershutdown /r
/aCancels the shutdown operationshutdown /a
/hHibernates your computershutdown /h
/t xxxSets the time-out period before the shutdownshutdown /r /t xxx
/fEnds all the applications and signs you out of the computershutdown /f

Note: Executing shutdown without a parameter will run help or /? for the shutdown command.

Driverquery

driverquery

Moving on, device drivers are integral components of a computer. If you seek information on them, we already have the Device Manager utility on Windows GUI.

However, if you wish to display detailed driver information while working on the command-line interface, you may simply type driverquery and hit Enter.

Along with that, you can utilize the following parameters each having individual functions:

ParametersFunctionsSyntax
/s <system>Specifies the name and IP address of your computerdriverquery /s [system]
/u <domain> <username>Specifies the user’s credentials and can only be used after /s is specifieddriverquery /s [system] /u [username]
/p <password>Specifies the user’s password and can only be used after /u is specifieddriverquery /s [system] /u [username] /p [password]
/foDisplays the output in the specified format–table, list, or csv/fo [table/list/csv]
/nh“No header”, meaning the header is not displayed (doesn’t work for /fo list)driverquery /fo [table/csv] /nh
/siDisplays signed driversdriverquery /si
/vDisplays verbose output (doesn’t work for signed drivers)driverquery /v

Hostname

hostname

This command prints the device name. If you’re unsure about yours or you’re trying to identify it on another computer, simply typing hostname and pressing Enter in the Command Prompt will display the result.

Syntax: hostname

Systeminfo

systeminfo

Unlike the hostname command, this will print detailed information about your computer. Basically, it’s like launching the System Information application to check your PC specs.

Moreover, you can use the same parameters used in devicequery (/s, /u, /p, /fo, /nh, /si, and /v) to print the output in your desired format.

Syntax: systeminfo [parameter]

Windows Troubleshooting Commands

If you’re facing a Windows-related issue, there could be several causes for it—corrupted drive, system files, images, or more. Usually, running useful troubleshooters and commands can fix the problem, and that’s exactly what I will cover in this section.

CommandFunction
chkdskChecks your disk drives to identify and fix possible errors or bad sectors
sfcScans the system files to determine corrupted ones and replaces them with a cached copy
dismManages Windows images
msdt.exe -id DeviceDiagnosticStarts Hardware and Devices troubleshooter

CHKDSK

chkdsk

This command checks for the local disks on the computer and informs users about logical and physical errors. Note that fixing errors is only possible if you use the following parameters wisely.

Here, I have only discussed the common ones. But if you want to learn more, here’s a complete guide on how to run CHKDSK to repair and fix a hard drive.

ParametersFunctionsSyntax
<volume>Scans the specified volumechkdsk <volume>:
/fFixes errors on locked disks (otherwise it first asks you to dismount the volume and completes the scan once you restart your PC)chkdsk /f
/vDisplays path and name of every file for FAT/FAT32 disks and cleanup messages on NTFSchkdsk /v
/rFixes the physical disk errors and performs all the operations that the /f parameter doeschkdsk /r
/xForces the volumes to be dismounted before performing the scanchkdsk /x
/iA quicker way to scan for disk errors for NTFS driveschkdsk /i
/offlinescanandfixPerforms offline scans to fix disk errorschkdsk /offlinescanandfix

SFC

sfc-scannow

The Windows System File Checker (SFC) helps you repair corrupted Windows files. It works by replacing corrupted files, which can even optimize the computer’s performance.

Here are some of the most used SFC commands:

ParametersFunctionsSyntax
/scannowAll system files are scanned and repairedsfc /scannow
/verifyonlyAll system files are scanned (no repair)sfc /verifyonly
/scanfile<file>The user-specified system file is scanned and repairedsfc /scanfile=[file path]
/verifyfile<file>The user-specified system file is scanned (no repair)sfc /verifyfile=[file path]

DISM

dism-online

This command starts the Deployment Image Servicing and Management tool to configure the features and packages of Windows images. There are plenty of DISM commands to use when troubleshooting Windows, including FFU, WIM, Imaging, and more. But I will only be discussing the common parameters.

ParametersFunctionsSyntax
/onlineTargets running OS dism.exe /online [parameters]
/imageSpecifies the path of an offline Windows imagedism.exe /image:<path_to_offline_image>
/list-imageDisplays all files and folders in the specified Windows imagedism.exe /list-image ImageFile:<path_to_image_file>
/delete-imageDeletes the specified Windows image from the WIM filedism.exe /delete-image /ImageFile:<path_to_image_file>

Additional Tip: To learn more about an individual command, you can execute the /? parameter at the end. For example, if you wish to find out more on /image, simply execute dism.exe /image /?. 

See also  Beginner's Guide: How to Use Command Prompt Effectively

msdt.exe -id DeviceDiagnostic

msdt-to-open-hardware-and-devices-troubleshooter

The Hardware and Devices troubleshooter is no longer available with the other troubleshooters in Windows Settings. However, the utility can find and fix related problems with all hardware components.

In Windows 11, you can launch it using the msdt.exe -id DeviceDiagnostic command on Command Prompt.

File and Directory Management Commands

Managing files and directories on Command Prompt can be a little tricky. Nevertheless, here are some of the basic commands that can make your tasks a lot easier.

CommandFunction
dirDisplays all the files and folders inside a directory
copyCopies files within the directory or from one to another directory
moveTransfers files from one directory to another
delDeletes a file or directory
mkdirCreates a new directory
renChanges file name
rmdirDeletes an existing directory
typeDisplays content of a text file
assocModifies the file type
fcCompares two files and displays their differences
attribChanges a directory’s attributes
treeGraphical representation of a directory structure of a specified path

DIR

dir

This command displays all the files and directories/subdirectories from the specified drive/directory. 

Most users utilize this command to list the files and directories. This is possible by simply executing the dir command. Along with the listings, it also displays the volume’s label, serial number, and the total number of files and directories.

Apart from that, you can also utilize the following parameters:

ParametersFunctionsSyntax
<drive>Displays the files inside the specified drivedir [drive]:
<path>Displays the files from the specified locationdir [path]:
/bDisplays just the list of items without any additional informationdir /b
/sDisplays all the files inside the directories, their subdirectories, and filesdir /s
/wLists all the files in a wide formatdir /w
/dSame as /w but sorts them by columndir /d

Copy

As the name suggests, this command copies the files from one location to another. Note that it will just create a duplicate instead of moving it.

Syntax: copy [filename] [path]

copy

For example, to copy the example.txt file from the D drive to the Example folder in the same drive, here’s the command I’ll use:

copy example.txt Example

Move

This command functions the same way as copy. However, the difference is that it actually moves the file from one location to the other. It’s basically the cut-and-paste technique we use in Windows GUI.

Syntax: move [filename] [path]

move

For example, to move the example.txt file from the D drive to the Example folder in the same drive, here’s the command I’ll use:

move example.txt Example 

Del or Erase

Both the Del and Erase commands can be used to permanently delete a file. This means that you can’t retrieve the file back from the Recycle Bin.

Syntax: del [filename]

del

For example, to delete the example.txt file permanently, here’s the command I’ll execute:

del example.txt

Note: Although we haven’t specified the parameters and attributes for copy, move, and del, you can test it for yourself using the help or /? parameter.

MKDIR or MD

Both the MKDIR and MD commands are used to create a new directory (folder). You can do this in the present directory or even on another directory directly, meaning you do not require moving to that specific drive/directory to create one.

Syntax: mkdir [path]\[directory_name]

mkdir

For example, if I’m in D drive and wish to create a new directory, here’s the command I’ll use:

mkdir MyDirectory

mkdir-outside-present-directory

But if wish to create a new directory in a specific path, here’s what I would execute:

mkdir C:\Users\bishu\Desktop\MyDirectory

Rename or Ren

Ren or Rename command simply reconfigures the file or directory name. While doing so, make sure you do not duplicate the name with any other file/directory.

Syntax: ren [path]/[filename] [new_filename]

Taking the same example as above, here’s how I am going to rename the two files I had created earlier:

ren MyDirectory MyDir

ren

ren C:\Users\bishu\Desktop\MyDirectory MyDir

ren-in-another-directory

RMDIR or RD

It stands for ‘Remove Directory’ and that’s exactly what the command does. You may also use a shorter command that performs the same action–RD.

Here are all the parameters for the RMDIR command:

ParametersFunctionsSyntax
<path>\<dir_name>Deletes the directory as per the specific pathrmdir [path]\[dir_name]
/sDeletes the directory along with all the files inside it (asks for confirmation)rmdir /s [path]\[dir_name]
/qDeletes the directory along with all the files inside it (doesn’t ask for confirmation)rmdir /q [path]\[dir_name]

As an example, I’m going to show you how to delete the MyDirectory file that I created earlier:

rmdir MyDir

rmdir

rmdir C:\Users\bishu\Desktop\MyDir

rmdir-outside-directory

Type

type

This command is used to display a text file’s content on Command Prompt. This way, you do not have to navigate to a certain location, open the file, and again close it if not necessary.

Syntax: type [path] [filename]
You may skip [path] if you’re in the same directory as the text file.

Assoc

assoc

This command is used to display or manage different file name extension associations. Note that you require administrative privilege to modify the associations.

See also  Beginner's Guide: How to Use Command Prompt Effectively

If you simply execute the assoc command, the command-line utility lists all the extensions along with their associated file types.

Syntax: assoc

Also, you can check which file extensions are associated with individual file types. For example, you can find out all the extensions that are associated with ‘sysfile’ as shown in the below example.

Syntax: assoc | find “[filetype]”

Example:assoc | find “sysfile”

assoc-find

It’s possible to modify the associations too. You can associate any file extension to whichever file type you want.

Syntax: assoc =

Exampleassoc .abc=sysfile

modify-assoc

Lastly, you can even delete an association. However, you’ll need to restart your computer to apply the changes.

Syntax: assoc [extension]=

Example: assoc .abc=

remove-assoc

FC

fc

FC stands for “File Compare” and as it sounds, it’s used for comparing two files so that you can learn about their differences. As shown in the demonstration above, I have compared two text files to know the item difference inside them.

Syntax: fc [file1] [file2]

Here are some of the useful parameters for the FC command:

ParametersFunctionsSyntax
/bComparison in binary modefc <file1> <file2> /b
/cIgnores the letter case during comparisonfc <file1> <file2> /c
/nDisplays the line numberfc <file1> <file2> /n
/uComparison of Unicode text filesfc <file1> <file2> /u
/wIgnores consecutive spaces when comparingfc <file1> <file2> /w

Attrib

attrib

This command manages the attributes for files and folders. You can set whatever attribute you wish—Hidden, Read-Only, System, and more. To set an attribute, use ‘+’ and to remove, use ‘-’.

Syntax: attrib [+/-][attribute_value] [file/folder name]

Attribute ValueDescription
HHidden
RRead-only
AArchive
SSystem
OOffline
INot content Indexed
XNo scrub
VIntegrity
PPinned
UUnpinned
BSMR Blob

Note: I haven’t mentioned the parameters for attrib (/s, /d, and /l). You can use the /? switch to learn more about them.

Tree

tree

If you’re wishing to view the subdirectories inside of a directory or a drive, the tree command will make it look graphically pleasing. It structures the document in an easy-to-view format. All you have to do is run the tree command and specify the path if required. 

Syntax: tree [path]

Below are the two parameters you can adopt with the tree command:

ParametersFunctionsSyntax
/aDisplays the lines using text characters instead of graphical representationtree <path> /a
/fDisplays all the items in the drive/directorytree <path> /f

Disk/Drive Management Commands

Along with file and directory management, it’s also possible to configure disks and drives in Command Prompt.

Here are the 7 most used commands for this purpose:

CommandFunction
volDisplays the disk volume’s label and serial number
formatFormats a certain drive in the specified file system
diskpartManages storage drive partitions
defragDefragments the specified hard drive
diskusageDisplays the amount of used and free space available on the specific disk

Vol

vol

This is a command to quickly check the volume name or serial number. All you have to do is execute vol with the drive letter.

Syntax: vol [dirve_letter]:

Format

format

While there already exists easy-to-use GUI applications for formatting your disk drives, it’s never a bad idea to learn this on Command Prompt.

If you want to format a hard drive having just one partition, the format command should work out for you. However, the better option would be using diskpart, which I shall discuss below.

Here, I’ll only mention the common parameters. Nonetheless, you can go through the other guide that should help you format a hard drive from CMD in detail.

ParametersFunctionsSyntax
/vSpecifies the volume label of the drive you’re trying to formatformat /v:<label>
/qPerforms a quick formatformat <drivename>: /q
/fsFormats the drive with specific file systemformat <drivename>: /fs:<filesystem>
/pCompletely wipes the driveformat <drivename>: /p:<count>

Diskpart

diskpart-1

This is a command-line interpreter that offers disk management features on Command Prompt. With this utility, you can assign drive letters, manage the drive attributes, configure partitions, display disk information, format a drive, and much more.

Type diskpart and this should launch the interpreter. However, you require administrative privilege to use it. 

In the table below, I have mentioned the most used commands in Diskpart. If you wish to learn more about disk partitions using the diskpart command, you can check out our dedicated guides for both HDD and SSD.

CommandFunctionsSyntax
listDisplays the volumes, disks, partitions, or virtual disks based on the parameter specifiedlist <volume/disk/partition/vdisk>
selectSelects a volume, disk, partition, or virtual disk based on the parameter specifiedselect <volume/disk/partition/vdisk>
createCreates a volume, partition, or virtual disk file based on the parameter specifiedcreate <partition/disk/vdisk> <parameters>
assignAssign a drive letter or mount point to the selected volumeassign <letter=[letter_number]/mount=[path]>
formatFormats a diskformat <parameter>
exitExits the Diskpart interpreterexit

Defrag

defrag

Defragmentation simply means reorganizing the data inside an HDD to achieve better performance (not recommended on SSD).

Like any other action, Windows already offers a dedicated utility.

However, if you wish to know this in detail, Command Prompt offers tons of parameters that should help you out. Note that this command requires administrative privilege.

ParametersFunctionsSyntax
<driveletter>:Defrags the specified drive (traditional defragmentation, default parameter is set to /d)defrag <driveletter>:
/aAnalyzes the selected drivedefrag <driveletter>: /a
/bPerforms boot optimization on the selected drivedefrag <driveletter>: /b
/cRuns operations on all the volumesdefrag <driveletter>: /c
/hRuns operations in normal prioritydefrag <driveletter>: /h
/uPrints the progressdefrag <driveletter>: /u

Diskusage

diskusage

This might not be the most used command but is definitely worth it. You can get the summarized details on the selected disk’s usage in no time.

Simply executing the diskusage command should do the job (note that you need to open CMD as an administrator). Along with that, you can take a look at the following parameters that might be beneficial:

ParametersFunctionsSyntax
/cDisplays the result in CSV formatdiskusage /c <drive>:
/hDisplays the result in human-readable formatdiskusage /h <drive>:
/s Displays size for system files onlydiskusage /s <drive>:

Networking Commands

Unlike others, networking commands are widely used mainly for troubleshooting purposes. In fact, fetching IP addresses or configuring network settings is much easier on Command Prompt than using GUI components.

If you’re a networking enthusiast, here are the commands that you need to focus on: 

CommandFunction
netManage network and its settings
ipconfigDisplays detailed information about your network configuration
netshStarts the Netsh prompt that lets you manage network configurations
netstatDisplays active network connections
pingVerifies IP-level connectivity and reachability
tracertChecks the computer’s path to connect to the network
pathpingTraces the route to the target and also displays the statistics (combination of ping and tracert)
getmacDisplays the MAC address
nslookupDisplays the information about domain names and IP addresses

Net

net-start

You can use this command to manage different networking services. It comes with multiple options each performing a specialized task.

Here, I’ve only mentioned the most common ones. You can execute the net command without a parameter to get more.

OptionFunction
accountsConfigures login requirements
computerManages computers in the domain
continueRestarts a service
startStarts a networking service
stopStops a networking service
viewDisplays all the devices in a network
statisticsDisplays network statistics

Ipconfig

ipconfig-command

This command is for network configuration and management. You can view the detailed Windows TCP/IP information, release/renew IP addresses, flush the DNS cache, and much more.

Executing ipconfig without parameters displays the IPv4, IPv6, subnet mask, and default gateway for every adapter. For other purposes, you can adopt the following parameters:

ParametersFunctionsSyntax
/allDisplays TCP/IP configuration for all adaptersipconfig /all
/flushdnsFlushses the DNS client resolver cacheipconfig /flushdns
/release <adapter>Releases the DHCP configuration for the specified adapter (you can simply execute the /release parameter to release the configuration for all the adapters at once)ipconfig /release <adapter>
/renew <adapter>Renews DHCP configuration for the specified adapter (if not specified, renews for all the adapters)ipconfig /renew <adapter>

Netsh

netsh

This is another essential networking command used for managing network configurations. You can execute netsh to launch the dedicated shell. After that, you can perform desired networking operations using some of the well-known parameters from the below table:

CommandsFunctions
dhcpclientManages the DHCP client service
dnsclientManages DNS client settings
firewallManages the Windows firewall service
interfaceManages physical or virtual network adapters
lanManages LAN settings on your computer
wlanManages wireless network settings on your computer
namespaceManages namespace configurations
offlineSets the mode to offline
onlineSets the mode to online
quit/exit/byeExits the Netsh shell
winsockManages Winsock settings

Additional Tip: You can further learn about each of the above command’s arguments using ? in the netsh shell or use the /? parameter with the netsh command.

Netstat

netstat

This command lists the active connections on your computer. It displays the protocol, local as well as foreign address, and the current state. Just executing the netstat command will list the active TCP connections.

To display other protocols, here are some parameters you can use:

ParametersFunctionsSyntax
-aDisplays all the active TCP and UDP connections netstat -a
-bDisplays all active connections along with each process (requires admin privilege)netstat -b
-eDisplays the interface statisticsnetstat -e

Ping

ping

This command is widely used for testing host-server reachability and internet connectivity. Executing ping displays the IP address statistics and the approximate round trips in milliseconds.

Here are a few parameters that I recommend trying out: 

ParametersFunctionsSyntax
-tContinues displaying stats until interrupted by pressing CTRL+Cping -t <target_name>
-n<count>Displays stats based on the specified number of echo Request messagesping -n <number> <target_name>
-l<length>Displays stats based on the specified lengthping -l <number> <target_name>

Tracert

tracert

This command traces the route to a certain IP or domain by sending ICMP or ICMPv6 messages with increasing TTL values. It’s extremely useful during network troubleshooting as it informs users about the routing issues and validates the network paths.

Implementing the tracert command without a parameter traces the route of the specified domain/IP over a maximum of 30 hops.

Nevertheless, you could make use of the following parameters to gain additional networking information:

ParametersFunctionsSyntax
-h<max_hops>Displays results in ‘n’ no. of maximum hops specifiedtracert -h <hops_in_number> <target_name>
-dDoesn’t resolve IP address making the results appear much fastertracert -d <target_name>
-w<timeout>Specifies the maximum time to wait for echo Reply message (if not, displays *)tracert -w <max_time> <target_name>
-4Uses IPv4 to trace the routetracert -4 <target_name>
-6Uses IPv6 to trace the routetracert -6 <target_name>

Pathping

pathping

This command is a combination of Tracert and Ping. When executed without a parameter, it traces the route to the target over a maximum of 30 hops and computes statistics for 125 seconds (by default).

Here are some of the most used pathping parameters:

ParametersFunctionsSyntax
-h<max_hops>Displays results based on the maximum hops specifiedpathping -h <number> <target>
-p<period>Waits between consecutive pings before displaying the statspathping -p <max_period> <target>
-w<timeout>Specifies the maximum time to wait for each replypathping -w <max_time> <target>
-4Only uses IPv4pathping -4 <target>
-6Only uses IPv6pathping -6 <target>

Getmac

getmac-in-cmd

If you wish to get the MAC address of your computer, you can execute the getmac command and this will display the result in no time. The result includes both the physical address and the transport name.

Along with that, I highly recommend trying out the following parameters:

ParametersFunctionsSyntax
/s <computer>Displays the results for the specified computer name of IP addressgetmac /s <computer>
/fo <table/list/csv>Displays in the specified formatgetmac /fo <table/list/csv>
/nhDisplays in the table or CSV format excluding the column headergetmac /nh

NSLookUp

nslookup

This is yet another command-line utility that includes numerous commands to obtain domain name or IP address information. To start the prompt, simply type nslookup in the Command Prompt and hit Enter.

While there are countless parameters for nslookup, I’m only going to focus on a few common ones in the table below:

CommandsFunctions
fingerConnection with finger server
lsDisplays DNS domain information
lserverChanges default server to the specified DNS using current server
serverChanges server to the specified DNS using default server
setDifferent parameters (all, class, d2, etc.) are used to set various DNS-related settings

Miscellaneous

If you have implemented each of the commands I’ve discussed, you should now be proficient enough to use Command Prompt. However, the aforementioned commands are not enough to master this Windows command-line interface. 

There are thousands more, and it’s impossible for me to include all of them in this single post.

For now, I would recommend trying out the following commands that could come in handy while you’re on the way to mastering Command Prompt:

CommandFunction
tasklistDisplays all the currently running processes
taskkillKills a process
powershellStarts Windows PowerShell session
setManages Windows environment variables
startRuns the specified program
bcdbootRepairs the boot environment
dateDisplays today’s date
promptChanges the cmd text
colorCustomizes foreground and background color

Tasklist

tasklist

You can use this command to display the currently running processes on your computer. Executing tasklist lists down the name of the process, its PID, session name, session number, and memory usage. Also, you can try out the following parameters:

ParametersFunctionsSyntax
/s <computer>Displays all the processes of the specified computer name or IP addresstasklist /s <computer>
/mDisplays all the modules of currently running processestasklist /m
/fo <table/list/csv>Displays the results in a specified formattasklist /fo <table/csv/list>
/nhDisplays the results in table or CSV format without the header columntasklist /nh
/svcDisplays all the services associated with the currently running processestasklist /svc

Taskkill

taskkill

While the tasklist command displays the processes, taskkill kills/ends them. You can use either process ID or image name to do this task. Therefore, you need to utilize any of the following common parameters:

ParametersFunctionsSyntax
/pid <processID>Kills the process as per the specified process IDtaskkill /pid <processID>
/im <image_name>Kills the process as per the specified image nametaskkill /im <imageName>
/fEnds the process forcefullytaskkill /f <pid/im> <processID/imageName>
/tEnds the process along with all the child processestaskkill /t <pid/im> <processID/imageName>

Powershell

powershell-on-cmd

If you prefer Windows PowerShell over CMD, you can actually run the Command Prompt as a Powershell window. Just type powershell and hit Enter. You’ll likely get the PS prefix indicating that you can now run all the Powershell cmdlets here.

Syntax: powershell

Set

set

This command is used for configuring the Windows environment variables. To display all the available ones, you can use the set command without any parameters. In order to set a new environment variable, you can use a variable name and provide the necessary value.

Syntax: set [variable_name] = [value]

setting-environment-variable

Likewise, it’s possible to delete any environment variable too. Below is the syntax that should clear your doubt.

Syntax: set [variable_name] =

deleting-environment-variable

The set command on Command Prompt has the following two parameters with individual functionality:

ParametersFunctionsSyntax
/aSets the variable name as a line of inputset /a <variable>=<expression>
/pSets the value as a numerical expressionset /p <variable_name>=<promptString>

Start

start

You can use this command to launch a new Command Prompt window. Without the use of any parameter, it will simply launch the new prompt. However, utilizing the following parameters can help you perform just more than that:

ParametersFunctionsSyntax
“title”Launches the CMD window with the specified titlestart “<title_name>”
/d <path>Starts the CMD window with the specified pathstart /d <path>
<min> or <max>Launches the CMD windows in restored or maximized windowstart <min/max>
/waitStarts the application and waits for it to end (meaning you cannot execute further commands in the main prompt)start /wait

BCDBoot

bcdboot

Most users utilize this command to repair the boot environment from the Windows Recovery Environment. It works by copying the Windows installation files to a system partition. You need to execute bcdboot with the following parameters:

ParametersFunctionsSyntax
/lSpecifies an optional language during BCD store initializationbcdboot <source> /l <locale> 
/sSpecifies the system partition’s label where the BCD files will be copied tobcdboot <source> /s <partition>
/dPreserves the existing default windows boot entrybcdboot <source> /d <path>
/bcdcleanCleans the BCD storebcdboot <source> /bcdclean

Date

date

This is another useful command to quickly check the current date. You can display or set a new date as per your requirement. If you execute just the date command, the prompt displays the date and asks you to set a new one. But if you quickly want to check the date, use the /t parameter.

Syntax: date /t

Prompt

prompt

This command offers customization of the text that appears in front of the cursor (by default, it’s the current directory path). 

You can change this to any character string of your choice or predefined characters (like current date, drive, path, times, windows version, etc.) using special codes. You can check using the /? Parameter. To switch back to the normal format, execute the prompt without any parameters.

Syntax: prompt [text/special_code]

Color

Certainly, you have thought of customizing the Command Prompt. To your surprise, it’s possible to tweak the default black (background) and white (foreground/text) combination. For this, you require specifying two hex digits—the first representing the background and the second corresponding to the text.

Syntax: color [hexcode]

Hex DigitColor
0Black
1Blue
2Green
3Aqua
4Red
5Purple
6Yellow
7White
8Grey
9Light Blue
ALight Green
BLight Aqua
CLight Red
DLight Purple
ELight Yellow
FBright White

As per the above table, let’s say you want a red background with light blue text. So, you’ll have to execute the following command:
color 49

color

While you’re at it, note that you cannot set the same background and foreground colors. Even if you do it, the command will not execute and you’ll be left with the existing combination.

To switch back to default, run the color command without any parameter.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1747

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

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