Typing DOS commands on the Windows Command Line prompt is a most efficient and faster way of doing things in Windows XP. Here's a run-down of the most useful DOS commands available in Windows XP. Some of these DOS commands even do not have an visual alternative.DOS Command-line tools must be run at the prompt of the Cmd.exe command interpreter. To open Command Prompt, click Start, click Run, type cmd, and then click OK.
ipconfig - Windows IP configuration
Useful for troubleshooting your internet connection. Displays the current IP address of your computer and the DNS server address. If you call your ISP for reporting a bad internet connection, he will probably ask you to run ipconfig.
fc - Free BeyondCompare in XP
FC is an advanced DOS Command that compares two files and displays the differences between them. Though the file comparison results are not as interactive as BeyondCompare or Altova DiffDog, fc is still very useful. You can even set fc to resynchronize the files after finding a mismatch.
type - open text files sans Notepad
Similar to Unix cat command, Type is my favorite DOS command for displaying the contents of a text files without modifying them. When used in combination with more switch, type splits the contents of lengthy text files into multiple pages. Avoid using the type command with binary files or you'll hear alien PC beeps and see some greek characters on your PC.
ping - Say hello to another computer
Ping network command followed by the web-address or IP address tells you about the health of the connection and whether the other party is responding to your handshake request. Ping tool can also be used to convert the web address to a physical IP address.
tree - visual directory structure
You often need to take prints of your physical directory structure but XP has no simple "visual" commands for printing directory contents. Here, try the Tree DOS command and redirect the output to a text file.
tree > mydirectory.txt
print mydirectory.txt
attrib - make hidden files visible
Attrib lets you change attributes of System files and even hidden files. This is great for troubleshooting Windows XP. Say your XP doesn't boot ever since you edited that startup boot.ini file (Hidden), use attrib to remove the Hidden attibute and edit the file using EDIT dos command.
assoc - which program will open that .xyz file
The assoc DOS command can be used to either isplay or even modify the file name extension associations. The command assoc .htm will quickly tell you the name of your default web browser (see picture)
move - more flexible than copy-paste
Say you got a lot of XLS and DOC files in you MyDocuments folder and want to move only those XLS files that have their name ending with 2006. In XP Explorer, you have to manually select each file and then cut-paste to another folder. However, the DOS move command make things much simpler. Just type the following at the command prompt:
move *2006.xls c:\2006Reports\
find - advanced file search with filter
Find is the most powerful DOS command and even more useful than the Windows Desktop Search tool or the Windows Find Wizard. The find command 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.
To search your hard disk to find and display the file names on drive C: that contain the string "Google" use the pipe (|) to direct the results of a dir command to find as follows:
dir c:\ /s /b | find "Google"
Quick tip - Drag to avoid typing: When your command acts on a file or folder, you must type the path to that folder after the command. You can save typing time by dragging the file or folder from Windows Explorer into the command window.
To view help at the command-line, at the command prompt, type the following:
CommandName /?
Related resources on Microsoft Website:
List of DOS Commands with Examples | Command Line Redirection Methods
Find this article at: http://labnol.blogspot.com/2006/04/useful-windows-xp-dos-commands-tricks.html
web: http://www.labnol.org/ email: amit@labnol.org

Reader Comments
I never used dos much and didnt know any dos codes. this will be very helpful
Written on 7/4/06 8:57 AM
Didn't know about the tree command. Nice one that.
Written on 8/4/06 11:21 AM
You can use the 'more filename' command directly--instead of typing 'type filename | more'
Written on 8/4/06 2:57 AM
Very useful reference. Commands like tree are amazing. Thanks for sharing.
Written on 7/4/06 6:10 PM
oh, another one, try pushd and popd (push directory and pop directory). when you pull up into console you are at what, documents and settings? try this -
pushd .
cd /
popd
that takes you back to documents and settings. it's a great replacement for trying to remember how many ..'s you are into the directory structure.
Written on 11/4/06 3:39 AM
netsh can be more useful than ipconfig when debugging and such. you can even reset the ENTIRE ip stack, if you are having connection issues and such, this is where i would start.
Written on 11/4/06 3:37 AM
This is so useful. I would also like to suggest the netstat DOS command which tells you the websites that your computer is trying to connect to or is already connected.
Written on 20/8/06 2:19 AM
I spend a LOT of my time at various command prompts; OS X, Windows NT/2K/XP, UNIX, Linux, etc. They are very handy and save a tremendous amount of time once you learn the commands. One thing that bugs me is when I hear people referring to the *NIX or NT command line as the 'DOS Prompt.'
Even though these environments look and feel like DOS they are not. DOS is an archaic operating system which has nothing to do with Windows XP. Many of the commands are the same because they all originated with UNIX many decades ago but have little to do with DOS.
'Command line,' 'Command prompt,' or 'Windows NT/XP Command line' are more accurate ways to refer to the text based command interpreter embedded in Windows XP.
Thanks,
Matt Boughton
Aptus Computers
http://www.aptuscomputers.com/
blog: http://www.boughtonent.com/
Written on 27/9/06 3:35 AM
This is an fantastic list, thanks!
Does anyone know if you can use exceptions in the "find" command?
Written on 6/10/06 11:47 AM
I tried piping the dir and find commands together but the find commmand searched text from the dir output (list of files) and not the contents of the files. Is there another way to search the contents of files for text starting with a root directory?
Thanks,
Kyle Pigeon
Written on 17/11/06 10:57 PM
Very good. I forgot about the FC command. very handy for checking stable backups.
See DOS is NOT dead!! Long live DOS!!
Written on 11/12/06 3:24 PM
These are really very helpful DOS Commands being used with Windows XP Command prompt. Actually, Windows XP doesn't contain DOS but it support cmd.exe command shell. More interestingly, Windows XP can create DOS bootable disk too. Thanks for sharing inportant tips.
Written on 18/12/06 4:16 PM
Replying to Kyle Pigeon:
To search the contents of files for text starting with a root directory, use "findstr", not "find". Type "findstr /?" at a CMD prompt. Example:
findstr /mis "tools" c:\path\to\your\files\*.txt
Above, /m will show only the filenames that match, /i will match case-insensitive, and /s will recurse down subdirectories (so be careful not to run this from the C:\ root, or you're in for a very long wait!).
Written on 17/1/07 4:37 AM
I have been working on computer since last 12 years. So I have used DOS thoroughly. In DOS or windows we cann't make a directory or folder called PRN. We can also make a directory with a hidden character so it cann't be open easily. By typing command at DOS prompt
MD directory name and then holding alt button + type 0255 from numeric keypad.
It will create a directory with a hidden character.
Written on 1/2/07 10:21 AM
PRN is one of several reserved device names, that's why you can't use it as a directory name. Other examples include the COM ports (COM1, COM2, etc), LPT ports (LPT1, LPT2, etc), CON and AUX.
Written on 8/2/07 8:25 PM
Another very usefull Dos command is
cmd>netconfig -s
It will display protocol wise usages on your computer see its help for other usefull parameters.
Regards,
Amit Agrawal
www.cisin.com
Written on 18/4/07 11:15 PM
If you want anymore DOS commands then open the DOS prompt and type in help and it will tell you all of the commands but be careful with some or they could mess up ur comp.
Written on 21/4/07 9:49 AM
the quick tip is awesome!!!
i've been working in windows since its inception and i've hated typing in the long cd paths. all the while there was this! thanks!!
Written on 24/4/07 12:34 PM
OK, for some reason MS won't allow DOS in XP. Dumb, from the user standpoint. So why not make Windows versions that emulate full-screen interfaces of the two most missed DOS programs, WordStar and PCFile? For what they do, nothing in Windows weill serve as well.
Written on 24/4/07 7:58 PM
Why "For Windows XP"? Weren't these commands available even before XP?
Written on 26/4/07 11:44 PM
someone earlier asked about find exceptions in dos... The switch is /v
normally when i use find, i also include the /i switch, becuase it's case insensative. so lets say i want to find all text files in the c:\ drive, in a list format, and exclude all *.txt files, i would type: 'dir/b/s/a c:\ | find /v /i ".txt"'
This would make it so it will exclude, .txt, .Txt, and .TXT, instead of just .txt.
instead of tree, you can use dir/b/a:d/s and it will give you a list of the full path to each subfolder in the folder you run the command from. this is very useful for a lot of things.
doskey is also awesome.
adding something like this to run when you open up cmd:
doskey live=start iexplore http://search.live.com/results.aspx?q=$1 $2 $3 $4 $5 $6 $7 $8 $9
will make it so when you run the command "live this is a search", a ie window will pop open searching live.com for "this is a search"
i should probably also mention that cmd.exe=32 bit, and command.com=16 bit, so when you go to start->run, you should always use cmd, as command is more or less a real dos environment, usefull for older applications.
"for" is also a very usefull command i could never live without, and "if" is great if you ever need to code batch files. both are commands in the shell, so you can run for /? or if /? to see what they do.
buddy nahay
nahayb .a.t. yahoo .d.o.t. com
Written on 25/5/07 12:39 AM
some cp pages go so fast you can't read them. is there a way to slow or stop the results?
Written on 9/6/07 12:40 AM
does anybody know
Why when i am printing in a "cmd" windows to a network printer
after appliing the "net use lpt"
command ,it take a long time too print ?
thak u
Ofir
Written on 25/6/07 7:45 PM
To see the result of any command in DOS by pages use a command MORE:
command-name | MORE [drive:][path][filename]
example:
mp4creator /? | MORE
Written on 29/8/07 3:45 PM
Replying to Matt boughton :
You need to get out more !
Written on 27/9/07 3:57 PM
Type NET>HELP to show you the whole list of codes.
Written on 9/10/07 11:15 AM
Is there a way to automatically save a web page to a text file?
Written on 31/10/07 10:40 PM