59 CMD Commands Every Windows User Must Know
One of the most efficient and faster way of doing things in Windows XP is to use DOS Commands. Here is a list of most useful DOS Commands used in Windows XP operating System. To open command prompt, type cmd in Run in Start Menu and hit enter. If you want help for any command mentioned below, type command name followed by / and ? like this one assoc /? will display help information for assoc. If ? alone is typed followed by enter at command prompt, it will display list of all commands.
1. assoc – Displays which programs will open the file with .xyz extension
It can be used either to displays or modifies file extension associations. If you just type assoc then it will display the list of all files extension and associated a program which is used to open that file. For example, assoc .doc will show you the name of program which the file is associated with.
2. attrib – Displays and changes file attributes (i.e. make hidden file visible)
It displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories. For example, if you want to edit boot.ini file which is a hidden file then you can use attrib command to unhide it and edit it with edit command.
Attrib tips: 1. “+” - Adds an Attribute 2. “–“ Removes an Attribute
Example: c:\>attrib resume.doc +hc:\>attrib rk-resume.doc +a -h
All Switches: a r h s where a = Archive, r = Read-Only, h = Hidden, s = System
3. bootcfg - Configures, queries, or changes Boot.ini file settings
For example: if you have two OS installed in your computer and you want to change the time in seconds after which default OS will be loaded, use this command bootcfg /timeout 10 where 10 stands for 10 seconds.
4. chdir or cd – Displays a list of files and subdirectories in a directory and also can change Directory or folder (i.e. Directory is called folder in windows world)
It displays the name of the current directory or can change the current folder. It will display the name of the current drive and folder if used like this c:\>cd.
Some more examples:
Folder by folder method: c:\>cd winnt; c:\winnt>cd system32
Absolute path method: c:\>cd c:\winnt\system32
Move to parent folder: c:\>cd..
Move to root folder: c:\>cd/
5. chkdsk – Checks a disk and displays a status report
This command will check the disk for errors and corrects them if instructed so to do with the use of switches. If is used without parameters, chkdsk displays the status of the disk in the current drive. This is one of the handy tools for me. Whenever I have doubt that my HDD might have some problem I run this command chkdsk /f / r in command prompt.
6. chkntfs – Displays or modifies the checking of disk at boot time
It displays or specifies whether automatic system checking (chkdsk) is scheduled to be run on a NTFS volume when the computer is started. It is mostly used with switches. If no switch is specified, chkntfs will display if the specified drive is dirty or scheduled to be checked on next boot.
Example: chkntfs c:
7. cipher - Displays or alters the encryption of folders and files on NTFS volumes
If it is used without parameters, cipher displays the encryption state of the current folder and any files it contains.
8. cls - Clears the Command Prompt window screen
If you have been typing lot of DOS command in command prompt and your screen is full with command then try cls. It will clear the screen.
9. comp – Compare the content of two files or set of files
This utility is similar to diff in Linux Operating System
10. control – Launch Control Panel from command prompt
This is applicable in Windows XP only. This is unpublished command and only used in windows XP. This allows you to launch control panel applets from the command line.
11. Copy – copy one or more files to another location
Here is the example how it can be used to copy files from one location to another. This command is always used in this format :
Copy “path of file to be copied” “path of the location where file has to be copied”
c:\>copy myresume.doc c:\resumeExample
c:\>copy a:\resume\rk-resume.doc c:\temp\resume
12. defrag – Defragmentation
This command is very helpful when you experience that your computer is very slow. First you delete all the windows temp files and internet temporary files and then run this command to defrag the hard disk. This will locate and consolidate fragmented boot files, data files, and folders on local volumes.
13. del - Deletes one of more specified files
Use it with cautious. This will delete specified file from hard disk. Use it only if you are comfortable with DOS and know difference between directories, folder or files.
Delete from current directory: c:\>del myresume.doc
Delete From Absolute Path: c:\>del c:\resume\rk-resume.doc
14. dir - Displays a list of a directory's files and subdirectories
If it is used without parameters, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk, including their names and the date and time each was last modified. For files, dir displays the name extension and the size in bytes. dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.
Lists the contents current directory: c:\>dir
Lists Contents of absolute path: A:\documents\pictures\bitmaps>dir c:\”program files”
Switches: /w /p /s
Sorting Switches: /oe /oen /od /on /one /x
Wildcards: * ?
Wildcard usage: c:/windows/system32>dir *.exe – will display files with .exe extension or c:/windows/system32>dir *.* - will display the file with any extensions.
15. driverquery - Displays a list of all installed device drivers and their properties.
16. fc - Compares two files or set of files and displays the differences between them
17. find – Advanced file search with filter capability
It Searches for a specific string of text in a file or files. After searching the specified file or files, find displays any lines of text that contain the specified string.
For example, I have a file called resume.doc in c driver and I want to search word “resume”. You can do it with or without filterWithout filter:
find “resume” c:\resume.doc – this will search the file resume.doc only for word “resume”
dir c:\ /s /b find "resume" – this will search complete hard disk to find word “resume” using filter
18. getmac - This command displays the Media Access Control (MAC) address for one or more network adaptors on system
It is very useful for IT professional.
19. gpresult - This utility generates a summary of the user settings and computer group policy settings.
20. gpupdate - you can use this utility to manually apply computer and user policy.
21. help – This provides help information for windows command
If it is used without parameters, help lists and briefly describes every system command. If you want to get help for command dir, just type help dir in command prompt and hit enter to see the details about dir command.
22. hostname – shows what is name of your computer
It displays the host name portion of the full computer name of the computer.
23. ipconfig – Windows IP Configuration tool – very useful for IT professional
It displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. If it is used without parameters, ipconfig displays the IP address, subnet mask, and default gateway for all adapters. Type ipconfig /? in command prompt to get more help.
24. mkdir or md - Creates a directory or subdirectory
mkdir creates any intermediate directories in path, if there it is not already there.
25. mmc - Microsoft Management Console (MMC)
If you are using the mmc command-line options, you can open a specific MMC console, open MMC in author mode, or specify that the 32-bit or 64-bit version of MMC is opened.
26. mode – configure system devices like COM ports etc
If it is used without parameters, mode displays all the controllable attributes of the console and the available COM devices. This is very useful for IT Professional to know the device setting like COM settings.
27. more - Displays one screen of output at a time
This is always used with another command.
For example, dir *.* more will show the result one screen at a time.
28. move - move files and rename files and directories
It moves one or more files from one directory to the specified directory.
Example - c:\>move resume.doc c:\resumefolder
29. msconfig - Windows configuration tool
This is an ultimate tool to change the services and utilities that start when your Windows machine boots up. Type this command in run directly.
30. narrator – Let your computer to dictate text to you
This is turns ON the system narrator. It can also be found in accessibility options in control panel.
31. nbtstat – NetBIOS Statistics
It displays NetBIOS over TCP/IP (NetBT) protocol statistics, NetBIOS name tables for both the local computer and remote computers, and the NetBIOS name cache. This is useful for IT professional.
32. netstat – Displays protocol statistics and current TCP/IP Connections
It displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics - for the IP, ICMP, TCP, and UDP protocols, and IPv6 statistics - for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols. If it is used without parameters, netstat displays active TCP connections.
33. netsh - A network configuration tool console
when you type netsh in command prompt, netsh> prompt appears. You can use different netsh command here. Type '?' in netsh command to list all the available command and type "exit" to get back to a command prompt.
34. nslookup – It displays information that you can use to diagnose DNS (Domain Name System) infrastructure.
This command-line tool is available only if the TCP/IP protocol is installed in your computer. It is an useful tool for IT Professionals.
35. pathping – Know packet loss at any given router or link
It provides information about network latency and network loss at intermediate hops between a source and destination. As it displays packet loss at any given router or link so it is very helpful in determining which routers or subnets might be having problem in the network. This is the most useful tool for a network professional. If it is used without parameters, pathping will display help.
36. perfmon – See the performance of your windows XP
This allows you to open a Windows XP Performance console which is already configured with settings files from Windows NT 4.0 version of Performance Monitor.
37. ping – Check if your network connection is OK
This command is used to check the IP-level connectivity to another TCP/IP computer by sending Internet Control Message Protocol (ICMP) Echo Request messages. Then the another computer sends back the Echo Reply message, along with round-trip times. Ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution. If it is used without parameters, ping displays help.
38. recover - This command can recover readable information from a damaged disk and is very easy to use.
Consult the online command reference in windows xp help before using this command.
39. reg – Console Registry tool for windows (Don’t use it if you don’t already know about it)
It can add, change, and display registry subkey information and values in registry entries.
40. regedit – Registry Editor (Don’t use it if you don’t already know about it)
41. rmdir or rd – It removes (i.e. deletes) a directory
Removes a Directory: c:\resume>rd temp-resume
42. route – It displays and modifies the entries in the local IP routing table
If it is used without parameters, route will display help.
43. schtasks – Schedule Task
This schedules commands and programs to run periodically or at a specific time. It can also add or remove tasks from the schedule, starts and stops tasks on demand, and displays & changes scheduled tasks.
44. shutdown – It allows you to shut down or restart your computer
If it is used without parameters, shutdown will display help.
45. start – This starts a separate Command Prompt window to run a specified program or command
If it is used without parameters, start opens a second command prompt window.
46. sigverif - verify driver signature in Windows XP only
Microsoft has created driver signatures to maintain the integrity of your system. Critical files have been digitally signed so that any changes to these files can be quickly detected. A signed driver is Microsoft tested and approved. You can check the drivers to verify that if they are all intact by typing sigverif in command prompt.
47. sysedit - System Configuration File Editor
This is an old tool that was very handy for the Windows 9X days. But msconfig is used in place of sysedit now days.
48. systeminfo – Know your Computer configuration
It displays detailed configuration information about your computer and its operating system. It includes operating system configuration, security information, product ID, and hardware properties, such as RAM, disk space, and network cards etc.
49. sfc - System File Checker
This is also very useful command. It scans and verifies the versions of all protected system files after you restart your computer.
50. tasklist – Know what programs are running currently on your computer
It displays a list of applications and services with their PID (Process ID) for all tasks running on your computer.
51. taskkill – Close the application from command prompt
You can close any tasks or application currently running directly from command prompt. Only thing you should know is the PID of that particular task. You can find out the PID by running tasklist command which displays the corresponding PID for an applivcation.
52. telnet – Connect to your remote computer
You can connect to your remote computer or remote IP device through telnet command. You can telnet your remote computer if you the IP address of that computer.
For example, type telnet 192.168.100.244 in command prompt and then it will prompt you to enter user name and password of the remote computer to check your authenticity.
53. tracert – Trace route – very useful for network professional
You can determine the path taken to a destination by sending Internet Control Message Protocol (ICMP) Echo Request messages to the destination with incrementally increasing Time to Live (TTL) field values. If it is used without parameters, tracert displays help.
For example, you can try tracert google.com.
54. Time – you can display or change the system time from command prompt by typing time
It will then prompt you to enter the new time you want to change.
55. tree – It displays the directory structure of a path or of a disk drive graphically
Windows XP doesn’t have direct command to print directory content so you can do that by combining following commands together. Try this tree DOS command and redirect the output to a text file. tree > directorycontent.txt
56. type – view txt files in command prompt without opening it with Notepad
It displays the contents of a text file. Type command is mostly used to view text file without modifying it. Lengthy text file can be splited into multiple pages with the help of switches.
57. ver - Displays the Windows XP version number
58. WMIC - Windows Management Instrumentation Command tool
You can view an amazing amount of low-level system information from a command line scripting interface with this command.
59. xcopy - Copies files and directories, including sub directories.
[I]. What is cmd.exe: you can launch command prompt by typing cmd in run prompt in the start menu.
[II]. What is SyetmRoot: The SystemRoot is the directory where the operating systems core files are located. Typically it is c:\Windows on Windows XP.
[III]. Where the applications are installed: Typically c:\program files\ is the location where most user installed applications are installed.
[IV]. What is the location of my Desktop and My Documents: The typical location of Desktop and My Documents is c:\documents and settings\.
For example: The user Rakesh’s documents would be located in c:\documents and settings\Rakesh\my documents (also desktop icons, documents, start menu icons and personal preferences will be stored here).
[V]. Shortcut to avoid typing lengthy file or folder name in command prompt: when your are working with a command and you need to type lengthy file or folder name, you can drag file or folder from Windows Explorer.
[VI]. How to get help for DOS Command: To view help at the command-line, at the command prompt, type the command name followed by “/” and “?”.
Example: dir /? - will display all the help information for dir command