Digital Inspiration

about us faq contact

Useful Windows XP DOS Commands & Tricks

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

Email This   Print Article   Save as PDF   Subscribe   Translate 


Download Free Google Software:


Reader Comments:

I never used dos much and didnt know any dos codes. this will be very helpful

Very useful reference. Commands like tree are amazing. Thanks for sharing.

You can use the 'more filename' command directly--instead of typing 'type filename | more'

Didn't know about the tree command. Nice one that.

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.

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.

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.

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/

This is an fantastic list, thanks!

Does anyone know if you can use exceptions in the "find" command?

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

Very good. I forgot about the FC command. very handy for checking stable backups.
See DOS is NOT dead!! Long live DOS!!

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.

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!).

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.

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.

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

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.

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!!

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.

Why "For Windows XP"? Weren't these commands available even before XP?

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

some cp pages go so fast you can't read them. is there a way to slow or stop the results?

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

To see the result of any command in DOS by pages use a command MORE:

command-name | MORE [drive:][path][filename]

example:
mp4creator /? | MORE

Replying to Matt boughton :

You need to get out more !

Type NET>HELP to show you the whole list of codes.

Is there a way to automatically save a web page to a text file?

Have a question? Need help? Visit the forums ».

Search For More Stories

Google Custom Search

subscribe

Get our E-Mail Newsletter

Subscribe in a reader


Quick Facts & Statistics

Digital Inspiration is a popular technology website with more than 5000 articles, tutorials and how-to guides related to software, computers, and internet.

The site launched in 2004 and averages over 2 million page views per month ..read more

FriendFeed Twitter LinkedIn YouTube Facebook Flickr

 laptop computer giveaway

Support Forums




 

© 2008 Digital Inspiration - Technology, à la Carte | FAQ | Mobile Edition | Videos | Terms

The articles are copyrighted to Amit Agarwal and can only be reproduced given the author's permission.

My Google  Netvibes  My Yahoo!  Windows Live  Bloglines  Newsgator  

Skip to top of the page ^^