Monday, December 17, 2012

DOS Command That Makes Our Life Easy

We know that DOS is outdated and we not require DOS in our daily life but the thing is, we don’t realize how easy it is to troubleshoot and fix certain computer issues using a few simple key entries. Like other Windows's operating system, Windows 7 and Windows 8 features a command prompt window.
Now that's enough for why we need DOS now I come to the point. This blog is for those of you that like the idea of typing in a few commands to avoid the hassle of several mouse clicks, I’m going to review few (around 10 or 12) of what I consider to be the most essential and helpful DOS commands that are still available in Windows 7. (I am not sure that all commands are also run in Windows 8 try it and let me know)

DOS IS THERE IN YOUR WINDOWS TERMINAL 

If you not know how to open a DOS in your machine then all you have to do is click on the Start menu, and in the “Search programs and files” field, just type “cmd” and press enter. Now we start with what you really want to see in this blog.

1.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 taskor type of file .
You can find out the PID or type  by running tasklist command which displays the
corresponding PID for an application.Figure shows you all of the following information,
after performing the tasklist and taskkill commands. 
/pid processID   Specifies the process ID of the process to be terminated.
/im ImageName  Specifies the image name of the process to be terminated. Use the       wildcard (*) to specify all image names.  
/f  Specifies that process(es) be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
   tasklist
 taskkill using  file type
 taskkill using pid


2. tracert – Trace route

You can determine the path taken to a destination by sending Internet Control Message Protocol (ICMP) Traceroute sends a sequence of Internet Control Message Protocol (ICMP) echo request packets addressed to a destination host. Determining the intermediate routers traversed involves adjusting the time-to-live (TTL), aka hop limit, Internet Protocol parameter If it is used without parameters, tracert displays help.
For example, you can try tracert facebook.com.
tracert [-d] [-h MaxHops] [-w TimeOut] [-4] [-6]target [/?]

-d = This option prevents tracert from resolving IP addresses to hostnames, often resulting in much faster results.
-h MaxHops = This tracert option specifies the maximum number of hops in the search for the target. If you do not specify MaxHops, andtarget has not been found by 30 hops, tracert will stop looking.
-w TimeOut = You can specify the time, in milliseconds, to allow each reply before timeout using this tracert option.
-w TimeOut = You can specify the time, in milliseconds, to allow each reply before timeout using this tracert option.
-4 = This option forces tracert to use IPv4 only.
-6 = This option forces tracert to use IPv6 only.
target = This is the destination, either an IP address or hostname.
/? = Use the help switch with the tracert command to show detailed help about the command's several options.
                                                              tracert command




















3. Assoc: Associated Extension

Displays which programs will open the file with .xyz extension
Not sure what default program you have set up to handle ZIP, MP3 or HTML files? A quick and easy way to check for your default file associations is the “assoc” command.  This DOS command in Windows 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.
assoc Command

4. DEFRAG 

The defrag command defragments the specified drive.  Depending upon the capacity of the drive and the amount of fragmentation, the defragmentation process can take a considerable amount of time to finish
As you can see from the example below,
I use “defrag e: /u /v”.
The /u switch prints the progress of the defrag to the screen,
      /v makes that output verbose.
defrag Command


5. CHKDSK -Checks a disk and displays a status report

This DOS command in Windows  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 you have doubt that your HDD might have some problem you run this command chkdsk /f / r in command prompt.

/f   Fixes errors on the disk.
/r   Locates bad sectors and recovers readable information .
 chkdsk command  


6. Ping

This command is very helpful to see if your Internet or network connection is slow and even gives you clues that your connection might not work at all. When you use the command, it send out packets of data to a specific address or server and calculates how long it takes for those packets to be returned. This time is calculated in milliseconds (ms) You can change the number of pings, the size of the packets being sent, the time the packets have to respond before it times out and much more. There is also a interesting parameter that let's you ping a IP address and it will return it's hostname address, if there is one.
  ping command with all parameter                    



ping command use



7. Nslookup 

This command is very useful for looking up either IP address or hostnames to resolve to one another. To use this command, you must first enter it, type: nslookup and press Enter. Then you are able to do your IP or hostname searches. When your finished, just type: exit to leave nslookup and return to the MS-DOS window.
nslookup command




8. Netstat 

This command its mostly used to show many details about your network connection. It shows multiple TCP/IP network connection statistics, protocols, information about port in use and much more. This command is very useful to determine which ports are open and if connected, to who. To maintain a close watch on your network, you should at least look at this command, a lot can be learned about your current network configuration and on your computers vulnerability. Look at figure  to see just a little what netstat can do, by identifying open ports, and helping you secure your system. 
nestat command



9. schtasks – Schedule Task

This Windows DOS command 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.

schtasks command



























10. time

you can display or change the system time from command prompt by typing time.This Windows DOS command will then prompt you to enter the new time you want to change.


time command "before changing time"


after changing time





11. gpresult and gpupdate

gpresult – This utility generates a summary of the user settings and computer group policy settings.
gpupdate – you can use this utility to manually apply computer and user policy.

These two command mostly use by IT professionals but you can also try these command and figures of these commands are given below. 

gpresult command

gpupdate command




12. 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.
sfc command including all parameters



Before ending this blog there one thing remain i.e. functions keys which are really helpful .While you’re typing one command after another, you can quickly navigate through commands with the following function keys:
  • F3 – Shows you the last executed command
  • F4 – Deletes any text you’ve just entered
  • F7 – Displays the entire list of recent commands you’ve used
  • F9 – Lets you select one of the commands from the F7 list to paste to the command line


Finally I write my first blog and also like to thanks my friends who motivate me to write this and also like to thanks you people who read this blog. If you like or dislike please comment .Your suggestion help me to improve my blog writing.