Changing the appearance of the desktop and other tips

There are thousands of possible tweaks and the ones that I have chosen may not suit everybody. Also there are a myriad of computer configurations and what works for me may not work the same for you. Most important of all, please remember that you should make no changes to your system before first backing up.

System Restore

A very important feature of Windows XP is the ability to return system files to the same state they were in at some previous point in time. Before making any tweaks create a new “Restore Point.” Go to Control Panel-Performance and Maintenance-System Restore or Start-All Programs-Accessories-System Tools-System Restore and select "Create a restore point.” (Note: this does NOT take the place of a complete backup.)

System Restore itself should be tweaked. If it is left alone, it will consume a good portion of your disk space with unnecessary restore points. By default it will use up to 12% of each of your drives. Although you may have a big hard drive and no need of the space, a lot of extra restore points can slow down processes such as virus checking, disk defragmenting, and other procedures. Go to My Computer, right-click, select “Properties” and then click the “System Restore” tab. These steps are illustrated in the two figures below below.

The figure above shows a system with only one volume or drive. Use the slide bar to set aside a reasonable amount of space. What is “reasonable”? It depends on your system but on mine, 200 MB (the minimum allowed) will hold 5 or 6 restore points and is all I use. Somewhere between the minimum 200 MB and 1 GB should suffice for most people. If you have a dual-boot system, highlight the drive where the other operating system is installed, click “Settings”, and put a check by “Turn off System Restore for this drive”. Also, if you have partitions for data, turn off System Restore there as well. There is no benefit from monitoring non-system files.

More about System Restore is on this page. A tutorial on System Restore in Macromedia Flash 6 format can be viewed at the sister site Windows for Beginners.

Error reporting

Microsoft wants information about any crashes you experience. Although it might seem like a good idea to let them collect data that could in theory help improve the operating system, I would prefer that information about my system, including a memory dump, not be sent out.For one thing, personal information can get included in the memory dump. Go to "My Computer" and right-click. Then choose "Properties". Click the “Advanced “ tab in the properties sheet that opens and then the “Error Reporting” button. The figure below illustrates the appropriate window.

As shown in the figure below, check "Disable error reporting," You can leave "But notify me when critical errors occur" checked.

Visual settings

If your computer is on the low end of having the power to handle all of the XP visual effects, you may find that performance is slowed. Or you may be like me and just prefer a less gaudy appearance. There is a lot of animation, shadowing, rounding and other things that consume computer resources. Also the color depth chosen may be more than you need or want. One route to adjust the system to your liking is to go to Control Panel-Appearance and Themes and make various changes there. Another route is to right-click My Computer, open the properties sheet and click the "Advanced" tab. (First figure in Error Reporting above.) In the “Performance” section, click the “Settings” button. The window in the figure below will open. Try “Adjust for best performance” to see how that works (Windows will probably change your theme) Or if you wish, you can unselect the various settings individually.

Return to the "Classic" Settings

Rather than fiddle with a lot of individual settings, you may prefer to return the look of your desktop to something resembling Windows 98. Right-click on an empty spot on the desktop and open the Properties sheet from the context menu. Select the Themes tab (First figure below) and in the drop-down menu choose “Windows Classic.” Click “Apply” and “OK”. If you prefer not to change the whole theme (including background and sounds) but just want windows and buttons changed, click the "Appearance" tab (second figure below) and in the “Windows and buttons” drop-down menu, select Windows Classic style. Click “Apply” and “OK”.

The new XP look to the Start menu can also be returned to the older style. Right-click on Start and open “Properties” from the context menu. Choose the radio button by the entry “Classic Start menu”. Click “Apply” and “OK”.

More tweaks are here

How to get rid of Windows messenger spam

The messenger referred to here is not to be confused with MSN messenger or other instant messaging services. Unfortunately, XP has two kinds of "Windows Messenger" which have almost the same name. One is an instant messaging application similar to other IM software such as AIM and ICQ. That messenger is the one that you use to chat back and forth with your buddies. The second one is what we will be discussing here and is the so-called "messenger service." This is a built-in service normally running in the background that is intended to allow systems administrators to send pop-up messages concerning maintenance and the like to the users on a local area network. Although this "messenger service" is of no particular use on a stand-alone computer or to most home users, it runs by default. Spammers have discovered that they can use this service to send pop-up messages to computers that are connected to the Internet. Judging from the number of complaints , the practice is pretty wide-spread. The spammers have computers that rapidly scan large numbers of Internet IP addresses and whenever they happen upon someone with an open XP system, a spam message is sent via the messenger service. The hapless PC user suddenly sees a pop-up window intruding on the screen with some sort of unwanted message, usually advertising. The pop-up windows can be identified by the name "Messenger Service" in the title bar. Since pornographic sites are among the active spammers, children may get inappropriate material. An example of a pop-up window is shown in the figure below.

Most typical home users do not need the messenger service, and it is easily turned off. As is usually true in Windows, there are several different ways but here is probably the quickest. Go to Start|Run and enter “services.msc” without the quotes, as shown in the figure below.

.

The Services module will open, listing all the services, as the next figure shows. Scroll to “Messenger”, highlight it, and then right-click to obtain the context menu.

Choose “Properties” (shown in the next figure) and then in “Startup type” choose “Disabled”. Click “Stop” and “OK”. Of course, you have to be using an account with administrator privileges (not normally a problem with the Home edition of XP)

You can also read the Microsoft article on how to stop Messenger spam. If you prefer a different route, Steve Gibson has written a little program to allow messenger service to be easily turned on and off. The free download and a discussion of the messenger problem is here.

To conclude, here is a word about the other Windows messenger, the one that is an instant messaging program. I do not use it but apparently those who do have also encountered spam or unwanted visitors there as well. To prevent messages from unknown users, go to the “Tools” menu of this program, choose “Options” and make sure that “All Others” is selected in the Block List.

The Start-Run Line

The "Run" line in the Start menu can be used to speed up access to a whole variety of functions. Some examples of the shortcuts that are available are discussed here.

Introduction to the Run Line

The Run command line may be one of the least utilized functions in the Start menu. This is a pity since it can be very useful. It is often the quickest way to launch programs or to open folders and documents. The figure below shows the Start-Run entry.

Start-Run entry

Clicking the entry "Run" opens the box shown below, where commands may be typed and entered.

Run line window

Opening applications in Run

Although applications can be opened in a variety of ways, the Run line often provides the quickest route. Desktop shortcut icons are also a quick route but you have to know how to create a shortcut for all the applications and you may end up with dozens of icons.

The best candidates for the Run line are applications that are in the "path" environment. (Go to this page for more discussion of the path.) The path environment is a set of folders whose names do not have to be included when entering a command. The path environment variable normally includes \Windows\ and \Windows\system32\. Many common accessories and Windows applets are in these folders and can be opened by entering just the executable file name. Several that I use constantly are the Registry editor (regedit) and the System Configuration Utility (msconfig). Note that neither of these frequently used system tools has an entry in Start- All Programs. The Run line is the standard method of accessing them.

A table listing some applications that can be opened in the Run line is given below.

A few applications for the Run line
Entry for Run Function
calc Opens calculator
cmd Opens command prompt window
explorer Opens Windows explorer
magnify Screen magnifier accessory
msconfig System Configuration Utility
mshearts Opens Hearts game
msinfo32 System Information applet
mspaint Opens graphics accessory Paint
notepad Notepad accessory
regedit Registry editor
sol Opens Classical Solitaire game

Programs not in the path require their full address, including the root folder and all subfolders. Actually typing long path names is not required since a "Browse" function comes with the Run line. This provides a way to search for files of interest and to enter them directly without typing. If desired, frequently used programs can be added to the path environment using the methods that are discussed in a section below.

Opening Management Consoles

Some of the functions that I find convenient to open by means of the Run line include various Management Consoles. For example, the disk defragmenter is opened by entering "dfrg.msc" . I find this easier than the multi-step process involved otherwise. A list of the appropriate file names for opening some of the various services is given in the table below. A more complete list is on this page.

Commands for some Management Consoles (msc extension required)
Entry for Run Function
ciadv.msc Manages the Indexing Service
compmgmt.msc Computer Management Console. It contains a number of the other consoles
devmgmt.msc Device Manager
dfrg.msc Disk Defragmenter
diskmgmt.msc Disk Management
gpedit.msc Group Policy Editor. Windows XP Professional only
services.msc Manages the many services involved in Windows and installed software

Opening Control Panel Applets

It is also possible to use Run to open the applets that appear in the Control Panel. A full discussion of shortcuts to Control Panel applets is given on this page. For example,entering "main.cpl" launches the mouse properties window.

Rundll32.exe

There are a number of commands employing Rundll32.exe that can be entered into Start-Run. A full discussion can be found here.

Opening folders in Run

Not only files but also folders can be opened in the Run line. Folders contained by a folder in the path are in this category. Examples are folders within \Windows\ and \Windows\system32\ such as the folders Fonts and "Drivers". Folders that are in \Documents and Settings\{Current User}\ can also be opened in Run. An example is SendTo (written as one word). Being able to open this folder in Run is convenient for editing. It makes it easier to add functions to the "Send To" entry in the right-click context menu. (See this page) Another example of a folder from the same location that can be entered is Cookies.
Note about Vista: Certain system folders like SendTo and Cookies are not directly accessible in Vista. See the page on the Shell command.

There are also some interesting shortcuts to folders that are available in Run. Typing the backslash (\) in the run line and entering it brings up the root folder, usually the C: drive. Typing and entering a period (.) brings up the folder \Documents and Settings\{Current User}\ in Windows XP (or Users\(Current User} in Vista). Entering two periods (..) opens the folder \Documents and Settings\ (or Users in Vista).

Dragging and dropping folders and files into the Run line

If the Run line is open (make sure it is empty) folders or files can be dragged and dropped on it from an open folder window. The full path of the dropped object will be inserted into the Run line and clicking "OK' or pressing the "Enter" key will open the dropped file or folder. Although this feature presents no particular advantage in general, it can be helpful to those who have trouble with double-clicking the mouse.

Adding applications to the Path

The ability to enter a short file name into the Run line to open a program can be extended to any program by putting the folder containing the program executable into the path. Adding folders to the path is described here.

Alternatively, the Registry can be edited to explicitly contain the path to the desired executable file or files. The Registry key involved isHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths

  1. Create a new sub-key with the name of the executable file that you wish to add to the path. e .g., HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\somefile.exe
  2. In this new key, add a string variable named "Path" containing the value of the the path to your new executable file, e.g., C:\Program files\newprogramfolder\
  3. The new key will already have an empty variable (Default). Edit it to have the string value of entire address of the new program executable , e.g., C:\Program files\newprogramfolder\somefile.exe
You can now enter "somefile.exe" into the Run line to open the program. An example of what the Regedit entries look like is shown in the figure below. I have added a chess game with the executable "winchen.exe" to the path.

A number of files are likely to have already been added on your system. Many applications place themselves here when they are installed. Examples are Microsoft Office components. It is sufficient to enter "winword" into the Run line to open Microsoft Word or "excel" to open Microsoft Excel.

Add to path in the Registry

Internet Applications

If you are connected to the Internet, entering an URL into Run opens Internet Explorer (or other browser if it is properly associated) and takes you right to the appropriate web site. The "Browse" function can be used to go to your Favorites folder and you can then click on a link. (Be sure the Browse function is showing "All files" as the file type.) On some systems it will even initiate a Web connection if you are not already on-line. You can also start e-mail by entering “mailto:someone@somewhere.com”. This will open a blank new e-mail with the address already entered. If you want to use an e-mail client other than the Microsoft application Outlook Express, it will have to be associated with the “mailto” function. Many e-mail clients do this automatically when they are installed. (As far as I know, this does not apply to AOL.)

Google supports a command line function that allows for simple searches on on a single term. Enter "www.google.com/search?q=%1" into the Run line, where %1 is the term that is being searched. A dash can be used to combine words. For example, try "www.google.com/search?q=windows-registry" (Omit the quotes.)

Comparison of Run with the Command Prompt

Although a great many commands can be executed in either the Run line or a command prompt, some commands will run directly only in one or the other. Commands which are built into the command interpreter cannot be entered in the Run line without first invoking cmd.exe. They are listed here. These include commands like "dir" and "del". Certain special features of the Run line such as the direct way of opening folders or the Internet shortcuts discussed above do not work in a command prompt unless prefaced with the command "Start".

Accessing the Command Shell from Run

The command interpreter can be invoked to carry out a command from the Run line by entering cmd /c some_commandWith the switch "/c", some_command will be carried out and the command shell will then close. If you want the command shell to remain open, use the switch "/k". Enter cmd /k some_command

The Run Line in Vista

The Start menu in Vista has no Run line in its default setting. Many of the functions of Run can be carried out in the new Search function that is at the bottom of the Vista Start menu but I still like to use Run sometimes. You can get Run back temporarily by using the keyboard shortcut Windows key+R. To put Run permanently back in the Start menu :

  1. Right-click on the Start menu and choose "Properties"
  2. Select the "Start Menu" tab and click on the "Customize..." button
  3. Check the "Run command" option

Configuring the Command Prompt Window

The interface to the command shell can be customized in a number of ways and these are discussed.
The default settings for the window that displays a command prompt can be changed to suit individual preferences. Among the properties that can be changed are those that affect the appearance such as window size, background and foreground color, and font style. Others that affect operation such as the editing mode and command history buffer can also be configured.

The command prompt properties dialog

Changing the settings for the command prompt can be done through the properties dialog box. This can be reached in the menu that is opened by left-clicking the icon in the left-top corner or by right-clicking anywhere in the title bar at the top of a command prompt window. In the menu that opens choose "Properties". Figures 1 and 2 show the procedure.

Fig. 1. Menu for command window Fig. 2. Entry for properties dialog
Menu for command window  Entry for properties dialog

The properties dialog box contains four tabs. Each of these is discussed below.

Options tabOptions tab

The figure on the right shows the dialog box for the Options tab. Settings here include provision for configuring cursor size and window or full-screen display. The "Quick Edit" mode allows you to use the mouse to cut and paste text to and from the command window. You can also choose insert or overwriting for editing by checking or unchecking "Insert Mode".

Command History buffer

A new feature is the "Command History" buffer. This buffer stores the previous commands that you have entered so that you do not have to retype them (reminiscent of Doskey). The default value is 50 but can be made as large as 999 (remember that they do take RAM) . The up-and-down arrow keys can be used to navigate the previously entered commands. Alternatively, pressing the F7 key will display a pop-up window with a list of the commands.

Font tab

This tab is more or less self-explanatory. On most machines, there is a choice of two font faces, Raster (the default) and Lucinda Console. Lucinda Console is more versatile. A selection of font sizes is available. As is true in general about settings, changes in font can be made for the present window only or for all command windows with the same title.

Layout tab

The window size and position can be set here. There are also settings for the screen buffer size. This determines how many lines back that you can scroll.( Incidentally, this ability to scroll back to previous commands was not present in DOS. Once something was off the screen, you couldn't scroll back.)

Color tabColor tab

The dialog box for configuring colors is shown on the right. The default colors for a command window and its fonts are the old black and white combination. However, other color combinations are available. The colors for pop-up windows associated with the command window can also be configured. As shown in the figure on the right, colors can be changed by clicking on the appropriate choice or by entering numerical values in the 256 color RGB notation. In the figure, I have chosen a blue screen background with yellow screen text as illustration. Color changes can be made for the current screen only or applied to all command windows.

Screen colors can also be changed with the "color" command or a command-line switch directly modifying the command interpreter. Both these methods are discussed below.

It is also possible to have shortcuts that open the command line with more than one color scheme and this is discussed in the shortcut section below.

Apply changes to all command windowsApplying changes to all command windows

Note that changes apply to the current command window only unless you specify otherwise. When making configuration changes, you will be shown the dialog box on the right. To make changes stick after the current command session is closed, check the button by the entry, " Save properties for future windows with same title".

Properties sheet for command prompt shortcutConfiguring shortcuts for the command prompt

If you use the command prompt a great deal, you may want to place a shortcut on the desktop or in the Quick Launch bar. After creating the shortcut, you can configure the properties of the command window that it will open in much the same way as discussed above. Right-click the shortcut and choose "Properties" from the context menu. Four of the the tabs at the top of the properties sheet will be the same as those discussed above. They are marked in the figure on the right. You can apply whatever customization you like and it will apply only to command windows that are opened from this particular shortcut.


Apply shortcut propertiesAnother way to configure the properties of a particular shortcut is to apply the changes in a command window that has been opened with that shortcut. After configuring the changes to the open command window by the methods discussed in sections above, the dialog box shown on the right will open. Check the button by the entry, "Modify shortcut that started this window".

The "color" command

The screen colors can be configured from the command line itself with the command "color" followed by a two-digit hexadecimal number. The first digit determines the background and the second determines the text color. The table below shows the relationship between the hex numbers and colors.

Table I. Hexadecimal color codes
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

For example the command "color 1E" will give a blue background with yellow text. Settings made this way apply only to the current session. Entering "color" with no argument will return the system to the starting colors.

Switches for the command interpreter cmd.exe

Another way to modify the behavior of the command prompt is to use switches with the command interpreter cmd.exe. The syntax for cmd.exe is:
cmd [[{/c|/k}] [/s] [/q] [/d] [{/a|/u}] [/t:fg] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] string]
Table II describes the parameters briefly. See the Windows Help and Support Center for more detail.

Table II. Switches for cmd.exe
Parameter Description
/c Carries out the command specified by string and then exits
/k Carries out the command specified by string and stays open
/s Modifies the treatment of string after/c or /k. See Windows Help for details
/q Turns the echo off. Default is echo on
/d Disables execution of AutoRun commands
/a Creates ANSI output (the default)
/u Creates Unicode output
/t:fg Sets the foreground f and background g colors. The hex codes for f and g are in Table I.
/e:on /e:off Enables or disables commands extensions. The default is "on"
/f:on /f:off Enables or disables file and directory name completion
/v:on /v:off Enables or disables delayed environment variable expansion
string Specifies the command you want to carry out

Commands that everybody can use

Since the command prompt is often used by systems administrators, many of the commands are specialized for networks and administration. However, the average PC user is not left out; there are some powerful commands for everyday tasks that anybody will find useful. Here we discuss some examples.

For convenience in the examples below, I will use simple names for files and folders without indicating the full path. Please remember that paths for all commands are relative to the folder indicated in the command prompt itself, unless explicitly indicated otherwise. The default reference folder is usually C:\Documents and Settings\(log on name)\. Thus if a reference is made to a file "somefile.txt", the computer assumes you mean C:\Documents and Settings\(log on name)\somefile.txt. If what you really want is C:\someotherfolder\somefile.txt, then you must enter the entire name with the correct path. Note that paths containing spaces have to be enclosed in quotes. A convenient way to be able to open the command prompt in a folder of your choice can be obtained by installing the Microsoft PowerToy “Command Prompt Here”. The right-click context menu will then contain an entry for opening a command prompt in any selected folder. The accessory can be downloaded here. Another way to get file names into the command line without having to type a long path is by using drag and drop. Open a command window and enter the command you want with a space after it. Then use Windows Explorer to open the folder containing the file you want to use. Drag the file over to the command window and drop it. (Drag and drop does not work in Vista.)

Power deleting with the expanded "Del" command

The delete command “del” now has a switch “/s” that provides for deletions in subfolders. Thus the commanddel /s myfolder\* will delete all files in myfolder and all files in any subfolders of myfolder. Note the convenient asterisk wildcard “*”, which allows for multiple deletions in a single user operation. Together with the switch “/s”, a single “del” command can clean out Temp folders and do other useful housekeeping chores. Another switch "/f" will force the deletion of read-only files. If you are sure about what is being deleted, add the “/q” switch to run in quiet mode so you aren’t asked if you really want to delete for every single file. Because of its power, this extended del command has to be used carefully. Any files deleted this way do not go into the Recycle Bin but are permanently removed.

To delete only files with a particular extension EXT, use the commanddel /s myfolder\*.ext Note that this command will delete all files of a particular type in a folder and all its subfolders. One example of its use is to get rid of all temporary files with the extension TMP.

Enhanced management of folders (directories)

The command "rmdir" or its twin "rd" are also expanded compared to the old DOS version. To remove folders (directories), use “rmdir” (just “rd” will also work). Folders must be empty before they can be deleted. However, there is a switch “/s” for deleting subfolders and with this switch files are also deleted. It is like the old command "deltree". The command rd /s myfolder will remove "myfolder" and everything in it. Adding the switch /q for a "quiet" mode is also possible.

Options have also been added to the command for making folders. The command “mkdir” or “md” can now make a whole tree. For example, consider the commandmd new\new1\new2 This will create a folder “new” with a subfolder “new1” that in turn has a subfolder “new2”.

Xcopy- Powerful and versatile way to copy or back up files

For copying large numbers of files or backing up a large folder, the command line is often the fastest and easiest way to go. The command “xcopy” is a very useful and powerful command for this purpose. (The old DOS also had an “xcopy” command but it sometimes had trouble with long file names. The XP version has no such problems.) “xcopy” comes with an alphabet soup of assorted switches that give it great versatility for use as a file backup utility. Enter “xcopy /?” in a command prompt to see them all. For example with the switch “/d:[mm-dd-yyy]” only files changed after a given date are copied. A command that will copy all files from the folder myfolder that have changed since June 1, 2003 to the folder mybackup is given byxcopy myfolder mybackup /d:06-01-2003 If no date is specified the switch “/d” will copy all files that have changed at any time.As is true in general, if there are spaces in a name, the path and file name have to be enclosed in quotes. Adding the switch "/s" provides that subfolders and their contents will also be copied. Other switches provide for read-only and hidden files. Altogether, there are something like 27 command line options for xcopy. More information is on this page.

How to list files with "dir"

The "dir" command is not new but it remains one of the most useful for average PC users. If you have ever wanted to make a list of all the files contained in a particular folder, you will have discovered that the Windows GUI provides no easy way to do this. It is very straightforward, however, when using the command line. The command “dir myfolder” will list the files and folders contained in myfolder. Again, there are switches that provide for various modifications of the command. For example “/h” will show hidden files and “/s” will list the contents of sub-folders in addition to those of the main folder. Of course, the normal output of the command is to the screen. To output to a file instead of the screen, the command isdir myfolder >listmyfolder.txt where “>” is the redirection symbol. The file "listmyfolder.txt" will be created by the command. Output can also be redirected straight to a printer on the LPT1 port but I think it is better to first create a file and then print from there if hardcopy is desired. These lists can be a lot longer than you might think. (These days most printers are on USB, anyway.) This use of dir is also available in Windows 98/Me.

The dir command can also be used to list only files with a given extension. For exampledir myfolder\*.doc /s >listmyfolder.txt will list all Microsoft Word files in myfolder and its subfolders. This form of the command will also list all the directories and sub-directories. If you want a list of filenames only, add the switch /b. The filename will include the full path.

Renaming files with "ren"

Renaming a a large number of files can be tedious. The command ren (also written rename) is somewhat limited but its ability to use wild cards can sometimes be useful. The basic command is ren file1 file2 The renamed file has to stay in the same folder as the original; this command cannot move files to another folder. The wildcard capability can be used to change the extension of all files of a certain type. Thus ren *.txt *.doc will rename all text files to have a DOC extension.

Moving files

The command "move" takes a file from one folder and puts it in another. Its ability to use wild cards makes it useful for moving all the files of a given type to another location. A command of the typemove /y folder1\*.mp3 folder2\will move all MP3 files from folder1 to folder2. The switch " /y" is used if you want to prevent the system from asking if it should overwrite existing files of the same name. To prevent overwriting, use the switch "/-y".

Changing file attributes with "attrib"

In addition to their actual content, files also have a set of properties that characterize them (sometimes called metadata.) One set of these properties are the four attributes read-only, hidden, system, and archive. The archive attribute is primarily used in backup procedures but the other three can be encountered in various contexts. These attributes can be turned on or off with the command "attrib" and its switches. The great utility of this command is that it can act on subfolders with its switch "/s" and can use the wildcard "*". For example, to clear the read-only , system, and hidden attributes from a file use attrib -r -s -h somefile This operation is not uncommon when system files have to be edited. To restore the attributes the command is attrib +r +s +h somefile A common situation where it is desirable to clear the read-only attribute from many files is when files are copied from a CD. By default CD files are normally marked read-only. This can interfere with editing. To clear the read-only attribute from all files in a folder and its subfolders use attrib -r somefolder\*.* /s If you want to process all files of a certain type such as MP3, use attrib -r somefolder\*.mp3 /s

How to make your favorite folder easily accessible in Windows dialog boxes

Another older command that I find handy is "subst". There are certain folders that I use over and over and I like to have ready access to them. One way to do this is to use the command “subst” to assign a drive letter to a folder. Since drives are at the top of My Computer and any folder trees in browse lists, it makes the folder very easy to get to. To map the “Z:” drive to a folder "myfolder", entersubst z: myfolder Unless you are working from the parent folder of "myfolder" you will need the full path for it. The assignment only lasts until the user logs off or the computer is shut down so I have a one-line batch file in my Startup folder that reinstitutes the assignment.

Other commands

There are so many commands that we can only give the briefest sketches here. A list of some that I think might be useful on home computers is given here. I urge you to look into as many as possible since I feel you will be surprised at how useful some can be. For example, there are a whole host of commands for checking network functions and for use on the Internet. (Many have names that begin with “net…”) There are new ones as well as versions of the well-known commands such as “ping” and “tracert”. As more and more people have home networks, these commands are assuming greater significance to the average PC user. Go to this page for more discussion of some networking commands.

Useful command line programs in scripts

Average PC users are not always comfortable using the command line and I have used VBScripts to wrap some of the examples discussed above with an easy-to-use graphical interface. Description of the free scripts and instructions for their use and downloading are at a sister site.

Command Line List and Reference

The complete list of possible commands is quite large. Collected here is a selection of those that I believe are likely to be the most applicable to home PC use.

Many of the commands listed below are also discussed in more detail elsewhere on this site as is indicated by the link "details here". Most commands have switches that are not given in the table. For more information, open a command prompt and enter "commandname /?" (without quotes). Detailed information about these commands and a larger list is available at this Microsoft reference.

Selected list of commands
Command Description Example
assoc Displays or modifies file name extension associations. Used alone, displays a list of all the current file name associations details here
at Schedules commands and programs to run on a computer at a specified time and date. Requires the Schedule service. Superseded by schtasks
attrib Configures file attributes read only, hidden, system details here
bootcfg Used to repair or edit the boot.ini file details here
cd or chdir Displays the name of the current directory or changes the current folder cd folderpath
chkdsk Checks hard drives for errors. With switches,does repairs. details here
cls Clears the screen cls
copy Copies a file from one location to another copy somefile somefolder
del Deletes one or more files details here
dir Displays a list of a folder's files and subfolders details here
echo Used to display a message or to turn off/on messages in batch scripts echo message
exit Exits batch script or current command control exit
fc Compares two files and displays the differences between them fc file1 file2
for Runs a specified command for each item in a set details here
fsutil Displays and configures certain file system properties. A suite of various commands details here
ftype Displays or modifies file types used in file name extension associations details here
getmac Returns the media access control (MAC) address for your network card getmac
goto Directs the Windows command interpreter to a labeled line in a batch program details here
if Performs conditional processing in batch programs details here
ipconfig Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings details here
md or mkdir Creates a directory (folder) or subdirectory (subfolder) details here
more Displays one screen of output at a time. Used with another command that has extensive output command |more
move Moves a file from one folder to another details here
net A suite of various networking and service commands details here
netsh Network services shell . Complex suite of commands. details here
netstat Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, statistics for the IP, ICMP, TCP, and UDP protocols details here
path Sets the command path in the PATH environment variable, which is the set of directories used to search for executable files details here
pathping Provides information about network performance and conditions at intermediate hops between a source and destination details here
pause Used in batch scripts pause
ping Checks connectivity to other networked computers, routers, or Internet sites details here
popd, pushd Changes the directory being referenced in a command prompt. Pushd changes the directory and stores the previous directory. Popd changes the current directory to the directory stored by the pushd command pushd somefolder
popd
powercfg Manages the power settings such as hibernation. Has numerous switches
reg Adds, changes, and displays registry entries. A suite of various commands details here
rd or rmdir Deletes a directory (folder) details here
ren or rename Changes the name of a file or a set of files details here
sc Used to obtain information about services and to configure them. A suite of various commands details here
schtasks Schedules commands and programs to run periodically or at a specific time
set Displays, sets, or removes environment variables details here and also here
sfc System file checker scans and verifies the versions of all protected system files sfc /scannow
shutdown Shuts down or restarts a computer details here
start Starts an application or opens a new command window details here
subst Associates a folder with a drive letter details here
systeminfo Displays detailed configuration information about a computer and its operating system systeminfo | more
taskkill Ends one or more tasks or processes details here
tasklist Displays a list of applications and services with their Process ID (PID) for all tasks running details here
tree Graphically displays the directory structure of a folder or drive tree somefolder
typeDisplays the contents of a text file type somefile.txt
xcopy Powerful command with many switches for copying and backing up files and folders details here

Introduction to the Command Prompt

DOS is dead, long live the command line

Before proceeding further, I wish to clear up a common misconception that the command prompt in Windows XP is the same as DOS. Even some experts who know better sometimes refer to the command prompt as a “DOS window”. In fact, Microsoft itself isn't always careful about the distinction. There are some superficial resemblances and some commands with the same name but in fact the old 16-bit DOS is dead. All remnants of DOS are totally gone from the Windows XP kernel (there is a DOS emulator for legacy programs). Windows XP is a 32-bit protected memory system with a totally different approach from the DOS/9X/Me family. The command line in XP has many more capabilities and none of the 16-bit limitations like the restriction to the DOS 8.3 file name format. The augmented capabilities make the command line a powerful tool.

The command prompt window

The command prompt is run from its own window by invoking the Windows XP command interpreter that is provided by the file cmd.exe located in the folder \Windows\System32\. (The old DOS command interpreter is command.com.) If you look in this folder you may also see several files that look suspiciously like some of the old DOS files. They are, however, different 32-bit versions with many new features. The command prompt window can be opened by entering "cmd" (without quotes) into Start-Run or through Start-All Programs-Accessories. A black and white window (the colors can be changed) containing the command prompt will open. The window looks just like the old DOS window but don’t be fooled, it isn’t. Note that it is possible to open several windows containing command prompts, all running independently. It is even possible to run a separate command prompt shell inside another command prompt window.

Internal and external commands

There are two kinds of commands that can be run from the command prompt. There are the internal commands that are built into the command interpreter like “del” and “dir”. These commands can only be run from a command prompt (or by invoking the command interpreter in some other way). They are listed in the table below. There is also a large list of external commands that use an additional executable file that can be run from either the command prompt or the Start-Run line. Details of the various commands are available in several places. In the Professional version of Windows XP there is a help file ntcmds.chm, which has details of all the commands and their many switches. The help file can be opened by entering (without the quotes) "hh ntcmds.chm" into Start-Run. It may or may not be in the Home Edition, depending on what setup you have. However, in both versions a list of many (but not all) of the commands available can be obtained by entering "help" (without quotes) into a command prompt. For more detail on a specific command, enter "help command-name" or "command-name /?" For example to get information on the command xcopy, enter "help xcopy" or "xcopy /?”. Microsoft keeps moving things, but the last time I checked they had a command line reference at this link. Some of the commonly used commands are discussed on this page and in the list given here.

Table I. Internal commands in the command shell
assoc dir move set
break echo path setlocal
call endlocal pause shift
cd exit popd start
cls for prompt time
color ftype pushd title
copy goto rd type
date if rem verify
del md ren volume

Some symbols that are used

In addition to the commands, there are several symbols that are used. These modify or combine the actions of commands. The table below gives a list.
Table II. Symbols used with commands
Symbol FunctionExample
> Sends output to a named file. If file does not exist, it creates one. Overwrites existing file command > somefile
>> Appends output to contents of a named file or creates a file if none exists command >> somefile
< Uses contents of a named file as input to a command command <>
¦ Sends ("pipes") the output of command1 to the input of command2 command1 ¦ command2
& Used to combine two commands. Executes command1 and then command2 command1 & command2
&& A conditional combination. Executes command2 if command1 completes successfully command1 && command2
¦¦ Command2 executes only if command1 does not complete successfully. command1 ¦¦ command2
@ Used in batch files at the beginning of a line to turn off the display of commands @echo off

The most commonly used symbols are the two redirection symbols ">" and ">>" and the so-called pipe, "¦" . (Just to make sure there is no confusion, the "pipe" is the symbol above the back slash on most keyboards. On keyboards it has a break in the middle but the break does not always show when you type the symbol. A special code is used to show it on a Web page.)

Recent Posts