WINDOWS TERMINAL COMMANDS

Windows Terminal Commands

Opening the terminal
—> Go to Run (Windows key + R) and Open cmd

By default you'll be in C:\Users\username>

You can access any of your drives by simply entering the drive with a colon.

one

Commands:

There are two types of commands. They are Internal commands and External commands.
Both command types are executed from the MS-DOS prompt.

Internal commands: They reside in COMMAND.COM, which loads into memory when the computer system is started and these commands do not reside on disk.

External commands: The external commands are files that do reside on disk and have an extension of .COM, .EXE, or .BAT.

Both internal and external commands are always available no matter what your current directory happens to be.

It may be worth noting that the cmd commands are not case sensitive.

Whenever you notice a message “Access Denied as you do not have sufficient privileges. You have to invoke this utility running in elevated mode” you want to run the terminal as the Administrator.

two

three

Internal commands

HELP: Displays all the commands of CMD in your Computer.

HELP with a command as argument displays the details of that command or to get help with a specific command type the command <space> /?

four

CD or CHDIR: The CHDIR (or CD) command either displays or changes the current working directory.

CLS: The CLS command clears the terminal screen.

COPY: Copies files from one location to another. The destination defaults to the current directory. If multiple source files are indicated, the destination must be a directory.

DATE: Displays the systems' current date and also prompts the user to edit it.

DIR: The DIR command displays the contents of a directory in detail.

MOVE: Moves the files from one folder to another.

MD: Creates a new folder in the present working directory.

RMDIR: Removes the specified directory.

DEL: Deletes a file.

TIME: Displays the systems' current time and also prompts the user to edit it.

MKDIR: Creates a new directory.

REN: Renames a file.

RD: Delete a folder.

TYPE: Displays the contents of a file.

VOL: Display a disk label.

VER: Display version information

TITLE: Set the window title for a CMD.EXE session.

START: Start a program, command or batch file.

EXIT: The command causes the shell to terminate.

COLOR: The color command enables users to change the default color of their background or text in their MS-DOS window.

five

six

External commands

ATTRIB: Displays or changes file attributes.

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.

It's interesting to learn that we can hide or un-hide folders using this command.

BOOTSECT: Bootsect updates the master boot code for hard disk partitions in order to switch between BOOTMGR and NTLDR. You can use this tool to restore the boot sector on your computer and it can be used for FAT and NTFS based file systems, replacing the FixFAT and FixNTFS tools.

CHKDSK: Checks a disk and displays a status report. The command has the ability to fix errors on a volume and recover information from defective disk sectors of a volume.

COMP: Compares the contents of two files or sets of files.
Note that you'll have to use wild cards to compare sets of files.

COMPACT: It's used to compress, uncompress, and view compressed files.
e.g: 1. compact
Displays all the files in the current working directory and their compact status.
2. compact file.txt
Displays the compact status of file.txt
3. compact file.txt /c
compacts file.txt

CONVERT: Converts a FAT volume into NTFS.
e.g: convert d: /fs:ntfs
Convert the d: drive, which in this example is a FAT volume, to a NTFS volume. Note, if this volume is anything other than FAT, such as NTFS or RAW, this command will generate an error.

DEFRAG: Optimizes and defragments files on local volumes to improve system performance.
e.g: defrag E: /A
It analyses the New Volume (E:) and reports the volume size, free space, total fragmented space, largest free space size and whether or not to defragment it.

DISKCOMP: Compares the contents of a floppy disk in the source drive to the contents of a floppy disk in the target drive.

DISKCOPY: Copies the contents of one floppy disk to another.
The two floppy disks must be the same type.
You may specify the same drive for drive1 and drive2.

EXPAND: It's used to take a compressed Windows file and expand it to its original format.

FC: File Compare, is used to compare two files against each other. Once completed, fc returns lines that differ between the two files. If no lines differ, you will receive a message indicating no differences encountered.
e.g: C:\Users\RAVITEJA\Desktop>fc a.txt b.txt
Compares the text file “a” and “b” on the desktop

FIND: Allows you to search for text within a file. Although CMD itself is not case sensitive, when typing in the string that you are looking for with the find command, you want to be case sensitive.

e.g: C:\Users\RAVITEJA\Desktop>find /c "the" a.txt
It looks for the word “the” in the filea.txt

FORMAT: Formats a disk for use with Windows.
e.g: format e:
This would erase the contents of your E: hard drive.

HOSTNAME: Displays the hostname of the machine the command is being run on.

IPCONFIG: Used to control the network connections on Windows. There are three main commands: "all", "release", and "renew". Ipconfig displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays the IP address, subnet mask, and default gateway for all adapters.

LABEL: Used to view or change the label of the computer disk drives.
e.g: label E: cap
This would label the disk currently in the drive to "cap", but will not label if your disk is write protected.

LOGOFF: It allows a user to quickly logoff their computer from the command line or terminates a session.

SHUTDOWN: Allows you to shut down or restart a local or remote computer. Used without parameters, shutdown will logoff the current user.
e.g: 1. shutdown /s /t 90
Shutsdown the computer after 90 seconds
2. shutdown /I
Immediately logsoff the current user
3. shutdown /r /t /50
Restarts the computer after 50 seconds

Note: Use “shutdown -a” to abort a scheduled shutdown or restart

SYSINFO: Displays operating system configuration information for a local or remote machine, including service pack levels.

TASKLIST: Displays a list of currently running processes on either a local or remote machine.

TASKKILL: Allows the user to kill a task from the Windows command line by process id (PID) or image name.

TREE: Displays the contents of all the directories and sub-directories within the specified drive graphically.

DELTREE: Deletes a directory along with all of the files and subdirectories that it contains.

NBTSTAT: Displays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP).
e.g: nbtstat -A 192.168.56.220
The above command would run nbtstat on 192.168.56.220

NET: The net command is used to update, fix, or view the network or network settings.
e.g: net localgroup
Display all groups currently setup on the computer you're running the command on.

NETSH: Enables users to change network settings such as changing their network device from a dynamic address to a static address or changing the IP address.
e.g: netsh interface ip show config
You can view network ip configuration

NETSTAT: The netstat command is used to display the TCP/IP network protocol statistics and information.
//e.g: netstat 5
Running netstat with a number after the command will continue to run the command until stopped. In this case netstat would be refreshed ever five seconds. To cancel press CTRL + C.

NSLOOKUP: We can look up an IP address of a domain or host on a network.
e.g: nslookup
Running nslookup without specifying an IP address or domain name displays your routers server and address. To get out of the > prompt type exit and press enter.

seven(1)

PING: It's used to determine whether a specific IP address is accessible. It works by sending a packet to the specified address and waiting for a reply. PING is used primarily to troubleshoot Internet connections.
It operates by sending Internet Control Message Protocol (ICMP) Echo Request messages to the destination computer and waiting for a response. How many of those responses are returned, and how long it takes for them to return, are the two major pieces of information that the ping command provides.

eight

In the first example we pinged the hostname www.google.com. By default it send 4 ICMP Echo requests with the packet size of 32 bytes.

In the second example, we pinged www.google.com again. The -n option tells the ping command to send 5 ICMP Echo Requests instead of 4 and the -l option sets the packet size for each request to 1500 bytes instead of 32 bytes.

The 0% loss reported under Ping statistics for 74.125.236.212 tells me that each ICMP Echo Request message sent to www.google.com was returned. This means that, as far as my network connection goes, I can communicate with Google's website just fine.

TRACERT: It is used to visually see a network packet being sent and received and the amount of hops required for that packet to get to its destination.

nine

In the first example we're asking tracert to show us the path from the local computer all the way to the network device with the hostname www.google.com and we can see that tracert identified eleven network devices including our router at 192.168.48.11 and all the way through to the target of www.google.com which we now know uses the public IP address of 173.194.36.115.

Whereas in the second example, you can see that I'm again requesting the path to a website, this time www.bing.com, but now I'm preventing tracert from resolving hostnames by using the -d option.
Here you can notice that tracert again identified eleven network devices including our router at 10.1.0.1 and all the way through to the target of www.bing.com which we can assume uses the public IP address of 204.79.197.200.
As you can see, tracert did not resolve any hostnames this time which I assure you significantly sped up the process.

Contributors:
Raviteja Palakurthy (2013145)
Sudhir Kumar (2014107)
Karlapudi Nikhil Raj (2013049)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License