Chapter 25. Maintaining and Optimizing System Performance

Running a Tight Ship

If you're reading this chapter, you probably are the kind of user or administrator who is interested in keeping your Windows workstation spinning like a top. Or maybe you are responsible for maintaining a myriad of computers on the company LAN, and your charges insist that you do the same for them. You're also likely to be looking for ways to boost the performance of your system by tweaking system software.

In this chapter, I'll start by discussing some of the techniques that will best serve you in the process of improving system stability and performance. The rest of the chapter deals with configuration of the various program application subsystems—Win32, Win16, and DOS.

Measuring System Performance with Performance Monitor

Before you can improve your system's performance, you need to find out how well it's currently performing. Use Windows XP's integrated Performance Monitor to learn what's happening inside your system in much more detail than is available from the Task Manager's Performance tab (that is, from the display you get to by pressing Ctrl+Alt+Del).

Performance Monitor creates a graphical or numeric display of essential system information, such as memory use, hard disk transfer rates, CPU activity, network traffic, and many other quantifiable aspects of your computer's real-time operations. You can display the gathered information in line graph, bar chart, or numeric format. Displaying this information is useful for trying to get a handle on what's happening with your computer, particularly when you're troubleshooting or tracking down bottlenecks.

Not only does Performance Monitor put up a real-time display, it also interacts with Performance Logs and Alerts (another administrative tool). Using a combination of the two, you can record performance data for later analysis, set up system alerts to send a message, run a program, or start a log specifying whether a counter's value is above, below, or equal to a defined threshold.

To start the Performance Monitor, click Start, Control Panel, Performance and Maintenance, Administrative Tools, and finally, double-click Performance.

When you start the Performance Monitor, the default display shows three counters, as shown in Figure 25.1. These counters are

  • Memory Pages/second—This counter indicates how many times per second Windows has to move programs or data between memory and the hard disk. Much of the activity measured by this counter is the swapping of data between memory and the hard disk's pagefile, which holds active programs and data that currently can't fit into memory. If this value frequently rises above 20, your system might have a memory bottleneck; add more RAM to the system to improve performance.

  • Average Disk Queue Length—This is the number of blocks of data waiting to be written to your hard disk, and generally should be no higher than 2 plus the physical number of hard drives on your system. If it frequently rises higher, your disk's transfer speed is too low.

  • % Processor Time—This is the percentage of time that your processor is actually busy doing your work. If this value frequently exceeds 85%, consider adding a faster processor.

The Performance Monitor displays operating system and hardware performance measurements in a chart format.

Figure 25.1. The Performance Monitor displays operating system and hardware performance measurements in a chart format.

Each measurement is color-coded, and the default graph of current activity uses a moving vertical red stripe to indicate where the latest information is displayed.

To add additional counters, click the + (plus) button on the toolbar. From the resulting dialog box, choose a computer to measure, the performance object (the choices include various system components such as Memory, Network Interface, and Processor), and then the specific performance counter.

What can you measure with the Performance Monitor?

  • Processor activity, including the percentages of time the processor handles many different types of activities.

  • Network activity, including data transfer rates to and from the specified computer.

  • Pagefile activity, including what percentage of your pagefile is in use at a given time.

All together, there are more than 40 different performance objects whose activity can be tracked with the Performance Monitor, and many offer 10 or more counters that measure different aspects of the object's performance. It's almost overwhelming what you can measure. Performance Monitor is a hugely flexible tool. If you're responsible for managing a computer network, you can mix and match counters and objects from different computers on the same graph. Therefore, you could, for example, compare some interesting statistics such as disk hits, print jobs, or network requests from different computers on the same graphical display to help you get a sense of bottlenecks in data throughput.

As you add counters to your display, the list at the bottom of the window grows, and each new counter is added to the chart and assigned a color. You can sort the list by clicking the column heads. If you wonder what a given counter is actually measuring, click Explain. You then see a description of the counter, as shown in Figure 25.2.

This dialog box lets you select from the myriad possible counters to display. Click Explain to read a description of a selected counter.

Figure 25.2. This dialog box lets you select from the myriad possible counters to display. Click Explain to read a description of a selected counter.

TIP

You can keep the Explain window open and click around on counter names to quickly learn about them, without clicking the Explain button each time.

To change the format of the display, click the toolbar icons labeled View Graph (which displays a performance versus time graph), View Histogram (which is a misnomer; it's actually just a bar chart of current values), or View Report (which displays current values in a table of numbers).

TIP

To single out one counter in a chart, click the Highlight button in the toolbar, and then click the object's name in the list at the bottom of the window.

Modify your charts by using various properties available from the Properties button on the toolbar. You can add a background grid; add x- and y-axis titles; change the scaling, fonts, and colors; and much more. Click the red-and-white X button to freeze the display for analysis, and click it again to capture new data. Click the Source tab to locate a log file to display rather than display current events. By changing the display, you can analyze logs you might have stored in the past (see the “Event Viewer” section in Chapter 27). If, at any point, you want to store a snapshot of your display, right-click in the display area, and choose Save As. Give it a name, and it is then stored as an HTML file. Clicking its filename in the Explorer brings it up in Internet Explorer, complete with graphics. This file is basically just a screen shot.

Tuning Windows Performance with the System Applet

When you discover how your system is performing, it's time to consider ways to speed up your system if you're not satisfied. The System Applet provides several ways you can improve your system's performance without wielding a screwdriver or opening up your system.

To open the System applet, click Start, Control Panel, Performance and Maintenance and System, or just right-click My Computer and select Properties.

The System properties sheet's General tab appears in Figure 25.3. The General tab lists the processor type, processor speed, and the amount of physical RAM (memory) installed.

This system has only the minimum amount of RAM necessary to run Windows XP Professional acceptably.

Figure 25.3. This system has only the minimum amount of RAM necessary to run Windows XP Professional acceptably.

First of all, if your system has 128MB of RAM or less, your first move to increase performance should be to upgrade your system's RAM to at least 256MB. Windows XP really, really likes to have lots of memory, and with today's prices, you can add an additional 128MB for as little as $20. Memory modules come in larger increments as well, if your computer is designed for them. You'll notice a big improvement in performance when you step up to 256MB. It can't hurt to add even more, although you probably won't notice as great an improvement as the jump from 128MB to 256MB, unless you use memory-hungry applications such as Adobe Photoshop and Microsoft Access.

TIP

If you're using a computer with its video built in to the motherboard (rather than located on a separate card), your effective memory is reduced by as much as 10MB or more because your system's memory is shared with the video card. For example, a system with 64MB of RAM that uses shared video memory (sometimes referred to as Unified Memory Architecture or UMA) can have as little as 54MB of available RAM, or even less! This is another good reason to consider a memory upgrade, or at least stay away from chipsets with integrated video (except those that use nVIDIA's nForce chipset).

If you already have at least 256MB of memory, or if you're looking for ways to fine-tune Windows to find more performance, click the System Applet's Advanced tab. It has five sections:

  • Performance

  • User Profiles

  • Startup and Recovery

  • Environment Variables

  • Error Reporting

Click the Settings button in the Performance section to get started.

Adjusting Visual Effects for Performance

If you have a modern, reasonably fast processor (that is, at least 500MHz), you can take full advantage of all the visual niceties provided by Windows XP's Visual Effects menu. However, if you're running with less than 128MB of RAM, have a processor under 500MHz, or have a slow video card (such as a PCI-based video card or typical motherboard-integrated video circuits), you might want to adjust Windows XP's defaults so that less graphics processing is required (see Figure 25.4).

Windows XP Professional's Visual Effects menu offers several animation and effects settings.

Figure 25.4. Windows XP Professional's Visual Effects menu offers several animation and effects settings.

If you select Adjust for Best Performance, all the animations and effects shown in Figure 25.4 are turned off. If you select Adjust for Best Appearance, all the animations and effects are turned on. If you use Let Windows Choose What's Best for My Computer, none, some, or all of the animations and effects will be enabled, depending on the speed of your hardware. For example, on my old 800MHz system with a fast AGP video card, all features were turned on except Smooth Edges of Screen Fonts. Select Custom to choose the options you want turned off or on. You can speed up screen displays by turning off options in the Visual Effects menu.

TIP

If you enable Smooth Edges of Screen Fonts, you can further fine-tune its behavior through the Appearance tab of the Display properties sheet. Click Effects and select either Standard or ClearType for the smoothing method, or disable it if you prefer. Standard or disabled are best for CRT displays and many presentation projectors. ClearType may be a better choice for LCD displays. (I say “may be,” as it's a matter of individual perception whether you think ClearType improves the display or makes it look fuzzier.)

Adjusting Processor, Memory, and Virtual Memory Usage

To improve the performance of your computer by adjusting processor, memory, and virtual memory usage, click the Advanced tab of the Performance Options sheet (see Figure 25.5). The Advanced tab provides three ways to affect the performance of your system:

  • Processor Scheduling—Adjusts the balance of processor time between programs and background processes.

  • Memory Usage—Adjusts the balance of memory usage between programs and system cache.

  • Virtual Memory—Adjusts the size and location of the paging file, which uses the hard disk to hold active applications and data that can't currently fit into memory.

The Advanced dialog box enables you to adjust three factors to improve system performance.

Figure 25.5. The Advanced dialog box enables you to adjust three factors to improve system performance.

These options are covered in the following sections.

Optimizing Virtual Memory (Paging) File Size

Windows XP Professional—like Windows 2000, Windows NT, Windows Me, Windows 9x, and Windows 3.x—incorporates a virtual memory scheme. As you might know already, virtual memory is a method for tricking the operating system into thinking it has more apparent RAM for use by applications than is physically present in the computer. Windows XP uses a hard disk file called pagefile.sys to simulate RAM. Windows XP's Virtual Memory Manager (VMM) constantly tracks the amount of free RAM, and when the available RAM is exhausted, the VMM begins swapping out 4KB chunks of data and instruction code to pagefile.sys. As portions of the data or code are needed, they are swapped back into RAM chips, where they can be used by the CPU. This activity is called paging. The upshot is that more applications and services can run simultaneously than would normally be the case. Paging is a big benefit when the memory required by programs that are actually doing real work at any given time is greater than the amount of physical memory. On the other hand, CPU access to the pagefile on your hard drive is monumentally slower than to your physical system memory, so when paging activity is high, performance plummets.

The default VMM settings applied when you install Windows XP Professional are based on your hard disk space and partition designations. Windows 9x and Me allowed only a single pagefile, although its size could vary. On Windows XP, however, a pagefile is created in the root of the partition containing the operating system, each additional partition can also have a pagefile.sys, and the size of the each file is dynamic. So, if you have several disks or partitions, Windows XP Professional can decrease the size of a pagefile on one partition and shift paging onto another one as available hard disk space decreases.

TIP

The automatic adjustment of paging file locations is a huge advantage for Windows XP over older Windows versions, and provides yet another reason for adding one of today's bigger, faster hard drives to your system. For best performance, you might want to tell Windows to put pagefiles on only newer, faster drives with fast interfaces and the most free space, as described in the following paragraphs.

Because Windows XP Professional is such a huge operating system and today's office suites, games, movies, and graphics editors are bigger than ever before, it's imperative that paging be intelligent and plentiful. This is especially important if your system barely exceeds the minimum RAM recommendation, as you learned in Chapter 2, “Getting Your Hardware and Software Ready for Windows XP.”

If you want to ensure that your hard disk doesn't thrash itself to death and that the system runs efficiently, not making you wait every time you switch between windows or move something around on the screen, you should install at least 256MB of RAM, let Windows manage the pagefile size, and keep lots of free space on your drive.

The default pagefile size is equal to the amount of RAM in your computer plus 12MB. As disk space dwindles, the file can shrink. The minimum can be no less than about 2MB. Usually, you should leave the pagefile at its recommended size, although you might increase its minimum size if you routinely use programs that require a lot of memory—this lets Windows allocate the pagefile space immediately, when there is less chance of having a fragmented pagefile. You can check with the software maker for information about how demanding applications might benefit from increasing the allocation.

You can optimize virtual memory use by dividing the space between multiple drives and especially by removing it from slower or heavily accessed drives. To best optimize your virtual memory space, you should divide it across as many physical hard drives as possible. When you're selecting drives, keep the following guidelines in mind:

  • Try to avoid having a large pagefile on the same drive as the system files. You should have at least a 2MB pagefile on the boot volume. The system requires this to write events to the system log, send an administrative alert, or automatically restart after a system Stop error occurs in the event of a system failure.

  • Avoid putting a pagefile on a fault-tolerant drive, such as a mirrored volume; some of today's high-performance systems come with mirrored IDE drives (where the second drive immediately reflects changes to the first drive). Pagefiles don't need fault tolerance, and some fault-tolerant systems suffer from slow data writes because they must write data to multiple locations. However, paging might benefit from being placed on a striped volume, where the data is spread out across two or more drives in parallel.

  • Don't place multiple pagefiles on different partitions on the same physical disk drive. This only makes your hard drive work even harder. Most systems have only one physical drive, so this is not usually a problem. If you have split the drive into more than one drive letter, be careful where you place pagefiles.

TIP

If you have multiple drive letters, it can be difficult to tell whether drive letters above C: are located on a second physical drive or are partitions of your first hard drive. Use the Microsoft Computer Management program (which you can access from the Administrative Tools folder in the Control Panel) and run the Disk Management tool to view local drives and their drive letters.

The following are some other points to consider when you're adjusting the pagefile:

  • Setting the pagefile's initial size and maximum size to the same value increases efficiency because the operating system does not need to expand the file during later processing. Setting different values for initial and maximum size can contribute to disk fragmentation. Expanding the default size of the pagefile can increase performance if applications are consuming virtual memory and the full capacity of the existing file is being used. To determine how large your pagefile should be based on your system workload, you should monitor the Process (_Total)Page File Bytes counter in the Performance Monitor. This counter indicates, in bytes, how much of the pagefile is being used.

  • Don't put a large pagefile on a disk that is used a lot, such as one used for serving applications and databases. It slows down overall performance.

  • The operating system always needs 5MB free on its partition. Be sure you don't use up the whole system boot drive.

  • Change the file size a little at a time, and test the performance.

TIP

For additional speed improvements, consider defragmenting your hard disk and upgrading your hard disk, hard disk controller, or motherboard for faster disk performance. Before installing a new IDE hard drive, find out which transfer protocol it uses. If the new drive uses Ultra DMA/66 or Ultra DMA/100, and your present IDE controller doesn't, you could have booting problems. See whether the drive manufacturer has provided a method of reverting to an Ultra DMA level supported by your system. If not, you might have to turn off DMA support completely in your system BIOS and suffer a large performance hit. Sometimes when you're upgrading a hard drive, upgrading the motherboard at the same time will serve you well, for just this reason.

“Serial ATA” drives currently offer even faster performance.

To change the initial and maximum size of the workstation's pagefile, the file locations, and the number of pagefiles, follow these steps:

  1. Open the Control Panel, and run the System applet, or right-click My Computer and select Properties.

  2. View the Advanced tab; then click Settings under Performance Options. View the Advanced tab and in the Virtual Memory area, click Change, and then Custom Size. You then see the dialog box shown in Figure 25.6.

    You can set Pagefile sizes and locations in this dialog box.

    Figure 25.6. You can set Pagefile sizes and locations in this dialog box.

  3. Edit the initial size and maximum size if you want to change them, and click Set.

TIP

Short on disk space? If you're seriously short on space, you can turn off the VMM and then delete the pagefile. You can't delete it while it's in use, though. So, first, you have to turn it off using the Control Panel's System applet. Then, reboot, and delete the inactive file using Windows Explorer.

You can use the Performance Monitor discussed earlier in this chapter to get a sense of how much virtual memory is being used. To get started, open the Performance Monitor and click the + (plus) button on the toolbar. Choose Paging File from the Performance Object drop-down list. Then add Usage and Usage peak. View the statistics in whatever way you like. Figure 25.7 shows an example. In this figure, you can see that even with 15 programs running, I'm still only at 3.354 percent usage, with a peak of 6.212%.

You can check virtual memory usage via the Performance Monitor by adding paging file monitoring for display in the chart.

Figure 25.7. You can check virtual memory usage via the Performance Monitor by adding paging file monitoring for display in the chart.

Setting Multitasking Priorities

As you know, Windows XP Professional is a multithreaded, preemptive multitasking operating system. Left to its own devices, it does an extremely good job of balancing user requests with the need for internal system operations and control. The result from the user's point of view is performance that appears to be highly responsive, even though some internal sleight of hand and task juggling might be going on under the hood. You'll really appreciate Windows XP's excellent multitasking capabilities when your system is sharing files and a printer, running a Web server, and at the same time juggling multiple browser windows, an email client, two or three word-processing documents, a spreadsheet, and a photo editor. Sound like your office?

As well as it works by default, one setting can slightly improve overall smoothness of Windows XP Professional's multitasking, depending on what you use your computer for. To set it, do the following:

  1. Click Start, right-click My Computer, and select Properties.

  2. Select the Advanced tab and click the Settings button in the Performance section.

  3. View the Advanced tab, shown earlier in Figure 25.5. In this dialog box, you can set the tasking priority for your applications.

  4. Click either Background Services or Programs, and save the change by clicking OK.

Normally, Programs is selected, ensuring that the foreground application (the window you're currently working with) gets more CPU time slices than programs running in the background. Time slices are also shorter and variably sized, which results in more responsive action from an application as you work in it. Unless you have CPU-intensive applications running in the background, though, you won't notice a difference in foreground performance.

If you're running something important in the background that bogs down too much when you're doing other foreground work on the computer, choose the Background Services option. Examples might be data acquisition programs, communications programs, Internet Connection sharing, a Web server, or a backup utility. The time slices are doled out in longer portions with this setting.

Setting Memory Usage

By default, Windows XP devotes more memory to running programs than to the system cache (the memory used for disk caching and handing background operations). If your computer is used entirely as a workstation and doesn't share folders, drives, or its Internet connection with other computers on a network, this setting should be left alone. However, if your computer is used as a server, and particularly if you have 256MB of RAM or more, change the default for Memory Usage (see Figure 25.5) from Programs to System Cache to improve performance for shared resources.

When you're finished customizing Performance settings, click OK to close the Performance Options dialog box and return to the Advanced tab of the System Properties window.

Enabling Data Execution Prevention

Since the early days of computing, most computer designs have allowed program instruction codes and data to be mi XEd together in memory. This has many advantages, but it's also made possible a whole category of security disasters, wherein hackers exploit program bugs to write new instructions into the program's data areas, and then fool the program into EXEcuting these new instructions. These program bugs take a lot of time to identify and eliminate, and there are untold numbers of them still lurking about, so programs and operating systems remain vulnerable.

To answer the security threat, some recent microprocessors now have as part of their memory-management hardware a feature that lets the operating system mark the data storage sections of memory as non-EXEcutable, so that the operating system can be notified if a program attempts to execute instructions in them. Starting with Service Pack 2, Windows XP can take advantage of this hardware feature, and calls it the Data Execution Prevention (DEP) option. At the time this section was written, only Intel's and AMD's 64-bit processors provided Execution Protection support, so DEP was available on the 64-bit version of Windows XP, and on the 32-bit versions of XP only while running on the Opteron and Athlon-64 processors in 32-bit mode. However, it may also be provided by newer 32-bit processors, so you should check to see if Data Execution Prevention is available on your computer.

To manage DEP, log on as a Computer Administrator, open the Control Panel, open the Security Center, and at the bottom of the screen double-click the System icon, to view the dialog shown in Figure 25.8. (You can also get to the Data Execution Prevention tab from the System Options/Performance dialog we've been discussing in the previous sections.)

If Data Execution Prevention is available on your computer, you can control it from the System Performance Options dialog.

Figure 25.8. If Data Execution Prevention is available on your computer, you can control it from the System Performance Options dialog.

If Windows indicates that your processor does not have the necessary hardware support, the dialog's options will all be grayed out, and you can simply close it and forget about it.

If the options are not grayed out, you should check Turn on DEP for All Programs to enable the feature. Thenceforth, if an application program attempts to execute instructions from protected memory regions, Windows will display a dialog box informing you of the program failure, and will terminate the application.

In almost all cases, EXEcuting instructions in writeable data memory occurs only as a consequence of a serious bug, or during a hacking attempt. There are some rare instances of application programs that legitimately write and execute instructions on the fly—”just-in-time” compilers like Java are an example. Also, some graphics processing applications use self-modifying code to squeeze out every last bit of performance. These programs should be updated by their manufacturer to work correctly under DEP. Until they're updated, however, DEP will not let them run. If you know you can trust a given application, you can disable DEP just for the one application by making an entry in the DEP configuration dialog. Click Add, and then locate the application's EXEcutable filename.

If a device driver fails with DEP enabled, you will get the dreaded “Blue Screen of Death” with the message ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY, and you will have to restart Windows. If this happens, I suggest that you restart Windows in Safe Mode, and attempt to identify, then disable or update the device driver that failed.

Note

→ To learn more about starting in Safe Mode, seeBoot Options,” p. 1276.

Setting Environment Variables

Settings that you're not likely to use but could still prove handy are the environment variables. What do environment variables do? They're a way to communicate setup information to application programs, from the days before the Registry. They indicate where temporary files are stored, what folder contains Windows program files, and other settings that affect program operation and system performance. In particular, batch files and application programs can use them to find where certain system files and folders are located.

Windows sets up a set of environment variables for you, including the ones listed in Table 25.1.

Table 25.1. Some Windows XP Environment Variables

Variable Name

Contains

ALLUSERSPROFILE

The path to the folder that contains files visible to all users, including desktop items, start menu items, and the “Shared Documents” folder[*]

COMPUTERNAME

The network name of this computer[*]

OS

“Windows_NT”, provided to let you write batch files that know when they're running on Windows NT, 2000, or XP, as opposed to MS-DOS, Window 3.1, or Windows 9x[*]

PATH

The list of folders that Windows searches when you try to run a program by entering only its name

PATHEXT

The list of file extensions that Windows considers to indicate runnable programs: .COM, .EXE, .BAT, and so on.

PROMPT

A specification of how Windows is to display the prompt in a Command Prompt window. By default, it is $P$G, which displays the current drive and folder behind the >

TEMP

The folder in which applications are to create temporary (scratch) files

TMP

Like TEMP. (Some applications look at the TMP variable and other applications look at TEMP to get the name of the temporary file folder)

USERNAME

The logon name of the current user[*]

USERPROFILE

The path to your profile folder, the folder that contains My Documents, your Start Menu, and so on[*]

SystemRoot

The path to the system32 folder in the Windows installation folder[*]

windir

The path to the Windows installation folder[*]

[*] These variables are informational only; changing their value doesn't change the corresponding location or name.

In DOS and Windows 9x, environment variables were usually set up in the AUTOEXEC.BAT file, using lines like this:

SET PROMPT=$P$G
SET TEMP=C:TEMP
SET PATH=C:WINDOWS;C:DOS;C:MOUSE;C:BIN

In Windows XP, environment variables for Windows applications are set up using a nifty graphical user interface. In addition, old DOS and Windows 3.x applications will see any environment variables set up by the AUTOEXEC.NT file, which we'll discuss later in this chapter, under “Configuring the MS-DOS Environment.”

NOTE

The environment variables defined here are seen by every Windows application, and are the initial environment variables set for each command prompt window. If you change environment variables in the command prompt window itself (say, using the set command in a batch file), the changes apply only to that window and will disappear when the window is closed.

By clicking the Environment Variables button on the System applet's Advanced tab, you can change the environment variables in the resulting dialog box (see Figure 25.9).

Examining the Environment Variables for the current user (top) and for all users of the system (bottom).

Figure 25.9. Examining the Environment Variables for the current user (top) and for all users of the system (bottom).

In this dialog box, you can create new variables, delete a variable, or edit a variable using the corresponding buttons. Notice that this dialog box has two sections, System Variables and User Variables. Environment variables set in the System Variables area are the default settings provided for every user account. This section can only be edited by while logged on to a Computer Administrator account. The User Variables section applies just to the currently logged-on user (that is, you), and each user can edit his or her own settings.

If you need to alter a variable, you must understand what happens if there's a conflict between environment variables defined in more than one place. As a rule, Windows examines several locations for definitions, and the last definition seen wins. Windows XP sets variables in the following order:

  1. System-level variables.

  2. User-level variables. (However, at this step, the PATH variable is treated specially. See the next section for details.)

  3. AUTOEXEC.NT-declared variables (seen only by MS-DOS or Windows 3.x applications). AUTOEXEC.NT contains commands similar to those used in the AUTOEXEC.BAT file used by older versions of Windows. We'll discuss AUTOEXEC.NT later in this chapter.

  4. Subsequent definitions, issued by set commands typed at the command prompt or encountered in a batch file. Environment changes made in a batch file persist at the command prompt, unless the batch file uses the SETLOCAL command.

CAUTION

I need to make an important distinction here. AUTOEXEC.NT settings (such as the SET BLASTER command, which sets up sound support) do not affect the default variables seen in the standard Command Prompt window, which is actually a 32-bit environment running the 32-bit CMD.EXE “shell” program. The AUTOEXEC.NT variable settings go into effect only when the Execution of an MS-DOS or Windows 3.x program causes a Virtual DOS Machine (VDM) to be created, and are seen only by the program(s) running inside the VDM. The Virtual DOS Machine subsystem is described in more detail later in this chapter.

You can view the effective MS-DOS environment by opening a Command Prompt window, running the old MS-DOS shell program COMMAND.COM, and typing set to list the defined variables.

Why modify system variables? Good question. Not many people need to. Probably the most likely reasons to modify these variables are to change the folder that applications use to create temporary work files, and to add directories to the system's search path. Or, you might have particular applications that require special environment variables set. Finally, some command-line utilities look for environment variables to set the default value of certain options. For example, copy checks to see whether an environment variable named COPYCMD has been defined, and if it has, it interprets COPYCMD as containing command line switches that can be used, for instance, to determine whether or not copy should prompt before overwriting files. I'll discuss these options in the next several sections.

Specifying the Location of Temporary Files

Many applications create temporary files to hold information while you're working. These files are usually deleted when the application exits. Sometimes, however, they're not deleted, and they can accumulate, taking up a lot of disk space. To make management simpler, you may wish to control where they are stored. By custom, most applications that do create temporary files create them in the folder named by either the TMP or TEMP environment variable.

By default, both TMP and TEMP are defined in the System Settings list as %userprofile%Local SettingsTemp. %userprofile% is an environment variable that contains the full path to your user profile folder. The net result is that, for my account, temporary files are created in C:Documents and SettingsknittelLocal SettingsTemp.

Now, for maximum security, placing each user's temporary files in a different folder is a good idea. Also, with Fast User Switching active, several users could have applications running at the same time, so placing temporary files in a different folder for each user avoids the possibility of conflicts in the filenames. On my own computer, however, I am not worried about inter-user security, and to make cleanup easier, I personally prefer to place temporary files for all users in a folder named emp on the hard drive with the most space. On my computer this is D: emp.

To specify the location of temporary files for your account alone, set the values of variables TEMP and TMP in the User Settings section. To specify the same location for all accounts, set the values in the System Settings section and delete any settings in the User Settings section.

NOTE

If you designate a folder in a partition that is formatted with the NTFS file system, be sure that the user or users who are set up to use it have read and write permissions on the folder! Ensure this by editing the folder's security properties, adding the group Users, and giving Users all permissions except Full Control. You may need to temporarily disable Simple File Sharing to view the Security properties.

NOTE

You might be inspired to create a separate folder for each user with a setting like D: emp\%username%. This will work, but you must create the folder for each user in advance. Windows will not create the folders automatically, and if the folder specified by TEMP or TMP does not exist, most applications will either fail, or will create temporary files in seemingly random locations.

Setting the PATH Environment Variable

Another important environment variable is called PATH. This variable lists the folders that Windows is to search whenever you attempt to run a program by typing its name without a path specification. For example, if I type regedit into a Command Prompt window, or into the Start, Run dialog, the Registry Editor window appears. But how does Windows know that “regedit” meant C:windowssystem32 egedit.EXE? The answer is the PATH variable. On my computer, PATH contains this:

D:Perlin;C:WINDOWSsystem32;C:WINDOWS; C:WINDOWSsystem32WBEM;"C:program filesscripts";
  "C:Program FilesSymantecpcAnywhere";c:progra~1winzip;"c:Documents and
  Settingsknittelscripts";c:in;c:at

The value of the PATH variable is a list of folder names separated by semicolons. If a folder name has a space in it, it is enclosed in double quotes, as “C:program filesscripts” and “C:Program FilesSymantecpcAnywhere” are on my computer.

Now, when I type regedit as a command name, Windows searches the folders named in the PATH variable in order, looking for the first one that contains an EXEcutable program whose name is regedit. It finds the standard Windows utility in the second folder, c:WINDOWSsystem32.

NOTE

The PATH variable is used for Windows programs as well as DOS programs; it's used any time a program is not specifically specified with a full path.

Many applications add their own installation folders to the path during installation. Thus, you will seldom if ever need to modify the PATH to provide access to programs that are designed to run from the command line. If you write batch files or scripts, however, it's very useful to put all of these into one folder and to enter this folder name into the PATH, so that you can run your batch files and scripts simply by typing their name.

Because it's so common for users to want to put a personal folder into the PATH, and because mis-editing the PATH variable can prevent Windows from being able to find applications it needs to run, Windows gives the “User Variables” PATH definition special treatment.

  • For the PATH variable, the User Variables definition is appended to the System Variable definition.

  • For all other environment variables, a User Variables definition overrides a System Variables definition.

In other words, you can enter your own personal folder(s) into the User Variables definition of PATH without worrying about messing up the standard definitions.

For example, a few paragraphs back I showed my computer's PATH setting. It's set up this way: the System Variables PATH definition is

D:Perlin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32WBEM;
"C:program filesscripts";"C:Program FilesSymantecpcAnywhere";
c:progra~1winzip;"%USERPROFILE%scripts"

These folders are used for every user on my computer. The User Variables PATH definition contains only my personal folders:

c:in;c:at

When I log on, Windows automatically adds my personal folders after the system-wide folders.

TIP

To make it even easier to have personal PATH folders, you can automatically give each user a place to store their own personal programs by placing %USERPROFILE%scripts in the System Variables PATH definition. This gives each user the option of creating a folder named scripts in their profile folder, into which they can put commonly used batch files, programs, and scripts.

You can also modify the PATH variable by directly setting the environment variable at the command prompt. It's best to do this by adding a new folder at the beginning or end of the existing path list, rather than by replacing the list entirely. Type the string %path% where you want the original PATH contents to appear. For example, you can add the folder c:myfolder to the head of the path list by typing

set path=c:myfolder;%path%

or to the end of the path by typing

set path=%path%;c:myfolder

You also can use this technique to modify the path from within a batch file.

Program Compatibility Wizard

One of the biggest concerns any user of a new Windows version is, “Will it run my software?” This fear goes all the way back to the birth of Windows, when Windows 386 was unable to run some programs designed for Windows 286, and Windows 3.x couldn't run all Windows 3.0 programs.

Fortunately, Windows XP Professional includes a Program Compatibility Wizard that can help you run your “golden oldie” Windows 95, Windows 98/Me, Windows NT 4.0, or Windows 2000 programs under Windows XP. Because many corporations upgrade software far less often than home or small-business users—a $100-per-copy upgrade is not terribly attractive when you have 10,000 users—this feature can be critical to your company's successful deployment of Windows XP.

By default, Program Compatibility is turned off for all the programs you install, because most 32-bit Windows programs will run with Windows XP without any problems. If you have problems with a particular program (game and education programs are the most common culprits), start the wizard by clicking Start, All Programs, Accessories, Program Compatibility Wizard.

When the wizard (which is part of Windows XP's Help and Support Center) starts, click Next after you read the introduction.

You can select the program that needs compatibility help from a list of programs already installed, by choosing the program currently in the CD-ROM drive, or by locating the program manually. After you select a program and click Next, choose the version of Windows you want Windows XP to emulate (note that Windows NT 4.0 compatibility is for NT 4.0 with Service Pack 5 installed) as shown in Figure 25.10.

The Program Compatibility Wizard lets you run your program in any of four modes compatible with recent Windows versions.

Figure 25.10. The Program Compatibility Wizard lets you run your program in any of four modes compatible with recent Windows versions.

After you select the compatibility mode, select any special display options needed by the program. For example, you can run the program in 256-color mode, 640x480 screen resolution, or without Windows XP visual themes without resetting your normal screen settings (see Figure 25.11). This is a great benefit if you have programs that normally require you to change these options before they'll work correctly.

Select color depth and resolution needed for your game, or disable the Windows XP visual themes if your program requires these special settings.

Figure 25.11. Select color depth and resolution needed for your game, or disable the Windows XP visual themes if your program requires these special settings.

After you choose the display options, click Next to test the program. If you chose display options, the screen might blank briefly as the monitor resets to the color depth and resolution you selected. When you close the program, you have the option to save the compatibility settings, discard them, or stop the process.

NOTE

There are still some application incompatibilities that the wizard can't fix. I've found a few older Windows programs that simply won't run under Windows XP under any setting of the Program Compatibility Wizard. There's nothing to be done in this case but contact the manufacturer. Some manufacturers are eager to hear bug reports and gracious about providing updates, but others—Epson Corporation is notable for this—basically tell you to go jump in a lake. That's life, I guess.

For incompatible but critical older applications, you can actually run them under the older operating system right on your Windows XP computer, using a PC emulation program like VMWare or Microsoft Virtual PC. For more information about emulation, see “The Virtual Machine Approach,” on page 1238.

Configuring the Program Environments

Chapter 23, ”Tweaking the GUI,” and Chapter 24, “Configuration via Control Panel Applets,” covered quite a few of the adjustments that you can make to the Windows XP user environment. Those chapters also addressed a variety of settings that affect the operation of Windows on a more rudimentary level, such as Properties sheets for printers and other devices you might have installed on a typical system or network. In addition to all these settings and properties, Windows XP allows for fine-tuning of program and system handling under the various operating system environments that Windows XP can control.

As discussed in Chapter 1, “Introducing Windows XP Professional,” and Chapter 2, “Getting Your Hardware and Software Ready for Windows XP,” in addition to standard 32-bit Windows applications, Windows XP can also run programs designed for MS-DOS and Windows 3.x. If you download and install the “Services for UNIX” (Interix) package, it can additionally run POSIX-compliant character-based applications.

How does Windows XP handle programs written for different operating systems? Windows XP has a feature called environment subsystems, which enables Windows XP to emulate a particular operating system's operation and translate a program's request for services into Windows XP commands. Each subsystem basically is an emulator responsible for providing the API for each operating system and then translating the API calls to the 32-bit Windows subsystem, which passes the commands onto Windows XP for processing. For MS-DOS applications, this includes monitoring the program's attempts to access hardware registers and memory locations that had special meaning to MS-DOS, and taking the appropriate action.

Some optimization and configuration of the various environments are possible, typically to allow for higher compatibility with non–Windows XP programs. Or, in some cases, the adjustments possible are purely aesthetic or convenience factors. The following sections describe options for configuring applications and subsystems. They also describe some specific programs or classes of programs (such as DOS-based TSRs) and how best to run them under Windows XP.

In the following sections, you'll learn about settings for the following subsystems:

  • Windows 16-bit

  • DOS

32-bit Windows tuning was covered earlier in this chapter in the section, “Tuning Windows Performance with the System Applet.”

VDM—The Virtual DOS Machine

Windows XP provides support for old MS-DOS and Windows 3.x applications through a program subsystem called the Virtual DOS Machine, or VDM. VDM is a program that mimics the hardware and software of a computer running MS-DOS. This program then loads and executes MS-DOS and Windows 3.x programs in a controlled environment. The “virtual” part signifies that an old program running in the VDM thinks it can directly control hardware like the video card and keyboard, when in fact, the VDM intercepts all hardware control attempts and uses Windows XP to carry out the desired operations safely. An illegal or dangerous hardware operation can simply be rejected. No user application program can directly manipulate hardware on Windows XP—that's why it's so sturdy. When you run a Windows 3.x application or an MS-DOS program, Windows XP runs it through the VDM where it can do whatever it wants without the risk of actually crashing the computer.

The Virtual DOS Machine can be configured by several settings and setup files, which I'll discuss in the following sections.

Configuring the Windows 3.x Environment

Windows XP runs Windows 3.x programs without a hitch thanks to its “Windows-on-Windows” or WOW system that lets these older Windows programs see the 16-bit Windows operating system environment that they expect. WOW in turn depends on the Virtual DOS Machine to provide emulated hardware support. This sounds complex, and it is, but from the user's point of view, you can just run an older Windows application and it just plain works.

One significant thing that WOW does is monitor the old configuration files WIN.INI and SYSTEM.INI. Old Windows programs expect to see Windows's system settings in these files in the Windows directory. Windows XP therefore keeps copies of these files up-to-date with your system's current settings. It also tries to detect changes made to these old configuration files made by legacy programs which are attempting to signal Windows to make changes.

One thing that WOW can't completely fix is the filename length limitation that hearkens back to DOS.

If you run DOS or Windows 3.x applications on Windows XP, you'll see truncated file and folder names in any program that looks at the hard disk directory. You see these shortened names because Windows 3.x applications were hostage to the limitation of DOS's 8.3 file-naming conventions. This limitation can be annoying, especially in a Browse box, but there's absolutely nothing you can do about it, short of upgrading to a 32-bit Windows version of the program.

If you can't upgrade, at least understanding how the truncated names are generated helps a bit. Following are some of the rules governing truncated NTFS and DOS file-naming rules and some hints for using them.

First, consider the rules of Windows 9x, NT 4, Windows 2000, and Windows XP long filenames:

  • Files and directory names can be up to 256 characters in length.

  • You can include a file type or extension, separated from the rest of the name by a period, such as 2002 Sales Reports.WKS. (If associated file extensions are hidden via the Folder Options, the extension is invisible in listings, however.) Windows XP doesn't care how many periods are in a name, and only considers the last one when looking for the file type: Sales.Reports.xls and Salesreports.xls are both taken to be Excel files.

  • Special characters not allowed are as follows:

    ?, “, , /, <, >, *, |, and :

  • Spaces can be included. No problem.

  • Uppercase and lowercase are both allowed, and they appear in listings. However, they aren't interpreted by Windows XP or its applications as being different from one another. In other words, you can't store a file called mybudget.xls and another one called MYBUDGET.XLS in the same folder, because Windows XP interprets both files as having the same name. If you tried to copy or move one file into the folder containing the other file, you would be asked if you wanted to replace the original file.

Windows XP automatically generates shorter DOS-compatible filenames when needed by a Windows 3.x program by doing the following:

  • Removing illegal characters and replacing them with _ (an underscore).

  • Removing any spaces in the name.

  • Using only the last period that has three consecutive letters after it as the extension.

  • Truncating the first name to six letters and adding a tilde (~) and a single-digit number as the last two characters of the first name; the digit is chosen to make the name distinct from other similar filenames. Consider these examples:

Windows XP Name

DOS/Windows 3.x Name

Quarterly Sales Reports.WK3

QUARTE~1.WK3

Quarterly Sales Reports. Atlanta.Georgia.WK3

QUARTE~2.WK3

Qrtr[Sales]Reports from Atlanta,Georgia.WK3

QRTR_S~1.WK3

When you use any programs that generate documents you're going to use with DOS and Windows 3.x applications, you might want to adopt a naming convention that makes sense to you when the longer names are converted to shorter DOS names. Try to use only one period, and use the extension that the application expects. Because the first six letters are retained, pack as much description into them as possible. And if if you stick to filenames of eight letters or less, plus a three character extension, they'll most likely look identical under the Windows 3.x and DOS applications.

Allotting Independent Memory Space for Windows 3.x Applications

Windows XP creates a separate instance of the virtual DOS machine (VDM) program for each MS-DOS program that you run, but normally all 16-bit Windows 3.x applications are run by one VDM. This is necessary because the old Windows depended on being able to directly transfer data back and forth between programs (or between multiple instances of the same program) by means of shared access to blocks of memory, in ways that modern Windows programs aren't allowed (again, for reliability's sake). The result is that, just like in a real Windows 3.x machine, a Windows 3.x application that crashes can take down the whole VDM, crashing any other Windows 3.x programs (but not, thankfully, Windows XP itself).

Well, unlike death and ta XEs, this isn't necessarily a fact of life. If you don't need your Windows 3.x applications to communicate with each other, you can cause an application to request its own VDM. The memory space that it runs in is then totally isolated, protected from other applications that might run amok. The upside is that one errant Windows 3.x application can't take down another. The downside is that any Windows 3.x applications running in their own memory spaces can't communicate with other Windows 3.x applications as they would in a true Windows 3.x computer. Dynamic Data Exchange (DDE) and services provided by shared Dynamic Link Libraries (DLLs) will not work, thus data- passing between applications is quashed. However, this isn't a big problem for most Windows XP users, because you'll probably seldom use more than one or two Windows 3.x applications at once anyway.

You make the setting to the properties for the Windows 3.x program. As an example, I'll use a Windows 3.x version of the popular Pretty Good Solitaire shareware program. To change the setting, follow these steps:

  1. Create a shortcut for the program in question; to make a shortcut, right-click the program icon in Windows Explorer and select Create Shortcut.

  2. Right-click the shortcut, and choose Properties. In the Shortcut Properties dialog box, choose the Shortcut tab, and then click Advanced. You then see the dialog box shown in Figure 25.12.

    You can set this option to give a Windows 3.x application its own memory space. You can do so only from a shortcut for the application.

    Figure 25.12. You can set this option to give a Windows 3.x application its own memory space. You can do so only from a shortcut for the application.

TIP

Many Windows 3.x programs were developed for 256-color displays, and might not function properly with the 65, 536, or 16.8 million color displays now used by Windows. If necessary, you can also use the Compatibility tab to select 256-color or other display settings, or to choose compatibility mode settings described earlier in this chapter in “Program Compatibility Wizard.”

From this dialog box, you have only to put a check in the Run in Separate Memory Space check box.

The other option, Run with Different Credentials, allows you to select which user name should be used to run the program. This is useful if a program was installed by a particular user, not by the system administrator, but you want all users of the computer to be able to run the program. Select the user who installed the program when prompted by the system.

Configuring the MS-DOS Environment

If you still use DOS programs, you'll be glad to know that the DOS environment that Windows XP uses is highly configurable. I discussed the Virtual DOS Machine or VDM in the previous section. It provides a simulated MS-DOS computer environment in which your old DOS applications run. It's also run “underneath” the simulated Windows 3.x environment, so it's used by old 16-bit Windows applications as well. You can configure it in several ways:

  • By configuring the user variables in the System dialog box, as discussed in the section “Setting Environment Variables.”

  • By making selections from the DOS window's Control menu.

  • By making settings in the Properties sheet for a shortcut to the DOS application.

  • By setting up custom AUTOEXEC.NT and CONFIG.NT configuration files you can address most special memory or environment variable setting requirements a DOS program might have.

  • By entering environment-altering commands at the command prompt.

You can choose from a great number of settings, including the following, all of which can be set for an individual program or as defaults to be used any time a command prompt window or DOS program is run. You can make the following settings:

  • Set the window font (including TrueType and bitmapped font styles)

  • Set the background and foreground colors for normal text

  • Set the background and foreground colors for pop-up bo XEs

  • Choose window or full-screen viewing

  • Set the default window position on the screen

  • Use or turn off the QuickEdit mode, which lets you copy text to the clipboard by highlighting it on the DOS window and pressing Enter

  • Use or hide the Windows XP mouse pointer in the application

In addition to these settings, you can set the search path and other environment variables, specify memory requirements (for EMS and XMS), and set other nitty-gritty options using Program Information Files (PIF files) and the System option in the Control Panel. Unless specified otherwise, Windows XP uses the file _DEFAULT.PIF, stored in the default Windows folder (usually either WINDOWS or WINNT), as the basis for MS-DOS sessions and running applications that don't have a PIF. When you alter the “properties” for DOS applications by right-clicking the application and making settings, you create a customized PIF file for that application. The result of running any DOS application, however, is that Windows XP Professional creates a PIF on-the-fly and assigns the default settings to it unless other settings are specified.

Note

Configuring the MS-DOS Environment

Note

Configuring the MS-DOS Environment

Customizing AUTOEXEC.NT and CONFIG.NT

You can choose to further configure the MS-DOS and Windows 3.x environment by modifying XP's equivalent of the old CONFIG.SYS and AUTOEXEC.BAT files. In Windows XP, as in Windows NT and Windows 2000, these files are called CONFIG.NT and AUTOEXEC.NT. They are the files used to configure each DOS VDM when it starts up.

When you run a DOS or 16-bit Windows application, Windows XP Professional creates a DOS VDM by loading the DOS environment subsystem and sort of “booting up” DOS. In the process, it reads in settings from CONFIG.NT and AUTOEXEC.NT in just the same way the original DOS read CONFIG.SYS and AUTOEXEC.BAT when it booted. The difference is the filenames and the file locations. In this case, the files are in the SYSTEM32 directory (usually WINDOWSSYSTEM32 or WINNTSYSTEM32) instead of the root directory. Each time you run a DOS application in a new window (that is, each time a new VDM is created), Windows XP Professional reads the CONFIG.NT and AUTOEXEC.NT files. The great thing about this capability is that you can change the settings and rerun a program, and the new settings get read and go into effect immediately. It's like rebooting DOS after fine-tuning CONFIG.SYS and AUTOEXEC.BAT—except faster.

Just remember:

  • The files CONFIG.SYS and AUTOEXEC.BAT in your hard drive's root folder are ignored by Windows XP. They're there only to fool really old applications that won't run unless they see that these files exist.

  • The files CONFIG.NT and AUTOEXEC.NT in WINDOWSSYSTEM32 are used but only when Windows needs to start up an MS-DOS or Windows 3.x application. The settings in these files affect only the one DOS or Win3.x application you're running at the time, because they're read by the VDM program before it starts up the old application.

The standard settings in CONFIG.NT set up when Windows XP is installed are shown in the following listing. The REM comments have been removed for brevity. (If you upgraded your computer from an earlier version of Windows, your CONFIG.NT may be different, as the installer may have retained some of your previous operating system's settings.)

dos=high, umb
device=%SystemRoot%system32himem.sys
files=20

TIP

On my computers, I always change the files setting to files=100, and add the line device=%SystemRoot%system32ansi.sys.

For more information about ansi.sys, see the next section.

TIP

If you need to specify different CONFIG.NT and AUTOEXEC.NT settings for various MS-DOS programs, see “Custom Startup Files” later in this chapter.

You can edit the CONFIG.NT and AUTOEXEC.NT files with a simple text editor like Notepad. Microsoft, for some reason, chose not to provide a comprehensive list of the settings permitted in CONFIG.NT in the online Help and Support, so I've listed them in Table 25.2.

Table 25.2. Commands Available for CONFIG.NT

Command

Description

country=

Sets the language conventions for the session.

device=

Installs loadable device drivers. Be careful with drivers that attempt to address hardware directly; they very likely won't work. However, you can load display drivers such as ANSI.SYS and memory managers such as EMM.SYS and HIMEM.SYS.

dos=

Tells Windows 2000 what to do with the Upper Memory Area (where to load DOS, as in dos=high).

dosonly

Allows only DOS programs to be loaded from a COMMAND.COM prompt. POSIX, OS/2, and Windows programs don't run. Note that a COMMAND.COM prompt and a Windows XP command prompt window's prompt are not the same. If you run COMMAND.COM, you get a DOS VDM window running the DOS command interpreter. Command Prompt windows run Windows XP's command interpreter (CMD.EXE), whose command set differs and expands on MS-DOS's.

echoconfig

Tells the VDM to print CONFIG and AUTOEXEC commands as they are executed from the files.

EMM

Configures the EMM (Expanded Memory Manager). Applies only when the program's properties specify that the value for EMS memory is greater than 0.

fcbs=

Sets the maximum number of file control blocks (FCBs). This setting is required only for truly ancient DOS programs.

files=

Sets the maximum number of open files. I recommend setting this to 100.

install=

Loads a memory-resident (TSR) program into memory before the window comes up or an application loads.

loadhigh=

Loads a device driver into the High Memory Area (HMA).

lh=

Same as loadhigh=.

ntcmdprompt

Replaces the COMMAND.COM interpreter with the Windows XP interpreter, CMD.EXE. After you load a TSR or when you shell out of an application to DOS, you get CMD.EXE instead, from which you have the added benefits of the Windows XP interpreter.

rem

Marks a line as a comment, causing the system to ignore it when “booting” the file.

stacks=

Indicates the amount of RAM set aside for stacking up hardware interrupts as they come in.

If you enter CONFIG.NT into the Search box in Windows XP Professional's Help and Support Center, some of these terms are listed under the Full-Text Search Matches section of Search Results. Click on the individual terms for more information.

The standard settings in AUTOEXEC.NT set up when Windows XP is installed are shown in the following listing. The REM comments have been removed for brevity. (And again, if you upgraded your computer from an earlier version of Windows, your AUTOEXEC.NT may be different).

REM Install CD ROM extensions
lh %SystemRoot%system32mscdexnt.EXE

REM Install network redirector (load before dosx.EXE)
lh %SystemRoot%system32
edir

REM Install DPMI support
lh %SystemRoot%system32dosx
REM The following line enables Sound Blaster 2.0 support on NTVDM.
SET BLASTER=A220 I5 D1 P330 T3

Here's what these do:

  • Mscdexnt gives DOS programs access to CDROM and DVDROM data discs.

  • Redir gives DOS programs access to shared network resources.

  • Dosx provides expanded and extended memory services.

  • SET BLASTER tells DOS programs, through an environment variable, how to use the emulated Sound Blaster compatible sound services provided by the VDM.

TIP

Editing these files properly is no piece of cake. You not only need to read about the configuration commands in Windows's Online Help and Support, I suggest you have at hand a good DOS reference like Que's Special Edition Using DOS 6.22, Third Edition.

Issues with DOSKEY and ANSI.SYS

Two of the most common enhancements used on MS-DOS computers were DOSKEY and ANSI.SYS. DOSKEY provided enhanced command-line editing: for example, the use of the up and down arrow keys to recall previous commands. ANSI.SYS gave DOS applications a way to easily control the position and color of text output onto the screen. Both enhancements are provided with Windows XP, although they don't work exactly as you might expect.

ANSI.SYS can be made available for MS-DOS programs simply by adding the line device=ansi.sys to CONFIG.NT (or an alternate CONFIG file). Unfortunately, there is no ANSI cursor support provided for 32-bit Windows character mode (console) applications.

Conversely, DOSKEY—which has been enhanced significantly from the old DOS days—functions only in the 32-bit Windows console environment, and even if you attempt to load it in AUTOEXEC.NT, it does not function within the MS-DOS “COMMAND.COM” shell; that is, after you've run any MS-DOS program in the Command Prompt window.

You can work around this limitation by instructing Windows to use CMD.EXE as the MS-DOS shell. Just add the line NTCMDPROMPT to your CONFIG.NT file. However, this may not work if you need to load Terminate-and-Stay-Resident (TSR) programs before your DOS application.

Setting the Command Prompt Window Properties from a Window

The command prompt window displays a text-mode window that looks a lot like a DOS computer's screen. This window is actually a true 32-bit Windows application, although it can also execute old MS-DOS applications. Settings you make in to the command prompt window affect both the Window itself and any DOS programs run it. In fact, by far the simplest means for altering the DOS environment is via the Properties dialog box of a DOS window. If you need to fine-tune the DOS environment, this is most likely the way you will do it.

When you open a command prompt window or run a DOS-based program, the window defaults to a standard size, background color, and font. Configuration options on the window's Control menu allow you to alter settings for the specific session. Options in the dialog bo XEs also let you save the settings to establish new defaults. You can set the properties like this:

  1. Choose Start, Run.

  2. Enter cmd, and press Enter. This runs the Windows XP command prompt, a true 32-bit Windows program. The settings you'll make here are applied to the VDM as well.

  3. On the resulting command prompt window, click the upper-left corner to open the Control menu, and choose either Properties or Default.

    • Properties sets the properties for this box and optionally all other bo XEs with the same title (as seen in the box's title bar) in the future.

    • Default applies the settings to all DOS-based programs and command prompt windows from here on out (even with other programs running in them).

    The resulting dialog box is the same in either case; only the window title is different. You can see it in Figure 25.13.

    Here, you can set the default properties for all command prompt windows.

    Figure 25.13. Here, you can set the default properties for all command prompt windows.

  4. Click through the four tabs, and notice the settings. You can click the ? (question mark) button in the dialog box and then click any of the settings to learn more about them. Some of the more useful settings are listed in Table 25.3.

    Table 25.3. Some Useful Console Window Properties

    Tab

    Item

    Description

    Options

    QuickEdit

    Check to enable copying to the Windows clipboard by selecting text and pressing Enter. Uncheck if you need to use the mouse with an MS-DOS application.

     

    Insert Mode

    Check to set insert mode as the default for command line editing; uncheck to overwrite by default. (Press the Ins key while editing to toggle.)

     

    AutoComplete

    Check to have the Tab key automatically complete a partial filename you've typed on the command line.

    Font

    Size, Font

    Sets the character size in the window.

    Layout

    Screen Buffer Size

    Sets the width and number of lines of text that are stored for the screen; if larger than the window size, you can scroll back to view previously displayed text.

  5. Make changes as necessary, and click OK.

If you're changing the properties for a specific window, the default is to change the properties for this window only. If you want to use these settings every time you launch this program, select Modify Shortcut That Started This Window, and then click OK.

When you make this choice, Windows edits the PIF for the DOS application in question (or the _DEFAULT.PIF in the case of a CMD window), storing the settings.

NOTE

The Control menu's Edit command and its associated cascading menu options are covered in Chapter 5, “Using the Simple Supplied Applications,” which describes the use of the Clipboard and OLE.

TIP

Setting a large buffer size can be a real boon if you run batch files or other programs that normally cause text to scroll off the top of the screen. A large buffer enables you to scroll back the screen and check program flow and error messages.

Editing Advanced Settings for a DOS Application

If you're experiencing difficulties while running specific DOS programs, you should read this section to learn about making deeper changes to the properties settings for them. When you manipulate the properties (via the PIF) for a program, Windows XP Professional fine-tunes the VDM environment for the particular application, allowing it to run more smoothly, or in some cases simply allowing it to run at all.

MS-DOS applications were designed to run in solitude. They assume that they are the only applications running and usually are memory hogs. Often they want at least 640KB of RAM and perhaps even extended (XMS) or expanded (EMS) memory. Running several non-Windows programs simultaneously—especially DOS programs—is just asking for territorial conflict.

To successfully accommodate the DOS-based applications still in use, Windows XP Professional must be ingenious in managing computer resources such as RAM, printers, modems, mouse devices, and display I/O. Significant sleight of hand is required to pull off this task smoothly, but Microsoft has done this fairly well, partly due to the use of PIFs.

PIFs (program information files) are small files stored on disk, usually in the default Windows folder (WINDOWS or WINNT) or in the same folder as the application. They contain settings Windows XP Professional uses when it runs a related application. When you modify the properties of a DOS EXEcutable or shortcut, Windows XP, in turn, edits the associated PIF. With the correct settings, the program runs properly, sparing you the aggravation caused by program crashes, sluggish performance, memory shortages, and other annoying anomalies. PIFs have the same initial name as the application but use .PIF as the extension (123.PIF, for example). When you run an MS-DOS application (using any technique), Windows XP searches the application's directory and the system search path for a PIF with the same name as the application. If one is found, this file's settings are applied to the DOS environment by the DOS environment subsystem before running the application. If no PIF is found, Windows XP uses the default settings stored in a file named _DEFAULT.PIF, stored in the WINDOWS or WINNT folder. These settings work for most DOS applications, but not all; games and educational programs are likely to need the most modifications.

TIP

In earlier versions of Windows, you had to edit a PIF using the PIF Editor. You no longer need to do so. For all intents and purposes, you can forget about the existence of PIFs and focus on a DOS application's properties instead by right-clicking the application and choosing Properties. However, if you have specific instructions provided with an older application for making PIF file settings, follow the advice provided for the program in configuring the application's properties.

DOS property settings can affect many aspects of an application's operation, such as (but not limited to) the following:

  • The drive and folder (directory) that is selected as the default when an application starts

  • Full-screen or windowed operation upon launch

  • Conventional memory usage

  • Expanded or extended memory usage

  • The application's multitasking priority level

  • The application's shortcut keys

  • Foreground and background processing

Some DOS programs come with PIFs, knowing you might run them under Windows. PIF settings from a Windows 3.x computer work under the Windows XP environment, so you can copy them to the appropriate directory, or take note of the settings on the Windows 3.x machine and reenter them on the Windows XP machine.

Earlier versions of Windows (namely Windows 3.x) sported more settings for DOS programs, but because Windows XP Professional is more intelligent than its now-obsolete sibling, many of them are history.

To edit these properties for a DOS program, do the following:

  1. Find the program file or a shortcut to it.

  2. Right-click and choose Properties. You then see a dialog box like the one shown in Figure 25.14. (In this example, I adjusted the properties for a DOS shareware game.)

    Setting the property settings for a DOS application.

    Figure 25.14. Setting the property settings for a DOS application.

Poke through each tab, and use the ? (question mark) button for help on the settings. Educational and game programs will most often require you to adjust the Memory and Compatibility settings.

NOTE

If you are on a domain network or if you have disabled Simple File Sharing, and if the program is stored on an NTFS-formatted partition, the standard Security tab will also be listed in the property dialog.

TIP

The Screen tab's Usage options determine whether the application initially comes up windowed or full-screen. You still can toggle between views by pressing Alt+Enter. Of course, in full-screen display, the mouse is surrendered to the application. When you use a mouse with a windowed application, the mouse works within the window on its menus, and with Windows once you move the mouse back to the Windows desktop. No DOS-based mouse driver is needed; the Windows XP driver works in either case.

If you use a shortcut to run an application that prints information to the screen, such as tracert, ping, or dir, see the next section to find out how to keep the window from disappearing before you can read the output.

Keeping a Command Prompt Window Open After Execution

When you run a command line program or batch file from the Command Prompt window, the window stays open after the program completes, and you can read any messages the program has printed.

However, if you the program or batch file from a shortcut, or by entering its name into the Start, Run dialog, by default the command window will close automatically as soon as the program exits. To keep the window open, follow these steps:

  1. Create a shortcut to the DOS program or batch file.

  2. Right-click the shortcut, and choose Properties.

  3. Select the Program tab.

  4. Uncheck Close on Exit. The window will now stay open after the program exits. You'll have to close it manually when you're finished reading its output.

TIP

If the command prints more text than fits on the screen and some scrolls off, you can usually simply scroll the window up to see the first part of the output. If more text is generated than the scrolling function can keep track of, you can increase the amount of stored text by editing the shortcut's properties. Select the Layout tab, and increase the Screen Buffer Size Height value. Alternately, run the program from a batch file and send its output through the more command by adding | more to the end of the command line. This will display one screen at a time. Press Enter to see each successive page.

Custom Startup Files

If you don't want every application's VDM to use the same AUTOEXEC.NT and CONFIG.NT settings, you can specify alternative AUTOEXEC and CONFIG files to be used instead, on an application-by-application basis. Here's how:

From the application's Properties page, select the Program tab and click the Advanced button. You then see the dialog box shown in Figure 25.15; here, you can name alternative files to be used. Just enter the names of the files. You should create your own modified files for this use. Start by copying CONFIG.NT and AUTOEXEC.NT from the WINDOWSSYSTEM32 folder to a new folder (the folder of the DOS application in question is a good spot). Then, edit them with a plain text editor such as Notepad.

You can specify a custom CONFIG.NT and AUTOEXEC.NT file for a given application.

Figure 25.15. You can specify a custom CONFIG.NT and AUTOEXEC.NT file for a given application.

The Windows XP Command Line

Despite the ease of use of the Windows graphical user interface, the command-line interface provides a useful way to perform many maintenance, configuration, and diagnostic tasks. Many of the most important diagnostic tools such as ping, tracert, and nslookup are only available from the command line, unless you purchase third-party graphical add-ons to perform these functions. Using batch files remains a useful way to encapsulate common management functions; batch files (or shortcuts to batch files) can be placed in shared folders as a way of distributing management functions on a network. Together, command-line utilities and scripts run with either Windows Scripting Host (wscript) or the command-line-based scripting host (cscript.EXE) provide a complete set of building blocks from which you can build very high-level utilities if normal Windows commands aren't sufficient for your needs.

The Windows XP Professional command-line utilities include many of the same programs found in DOS and earlier versions of Windows. In many cases, the programs have been enhanced considerably. Utilities not found in DOS or Windows 9x are also available.

Command-line programs fall into five categories, as shown in Table 25.4.

Table 25.4. Categories of Command-Line Programs

Types of Commands

Description

Built-in

These commands are built into the command interpreter; for example, dir, copy, and rename.

Native

These commands call .EXE files; for example, sort.EXE, net.EXE, and more.EXE.

Subsystem

These commands are .EXE files from older operating systems that were designed to adjust the environment or interface. They run inside the virtual DOS machine. Examples are DOSKEY, SETVER, himem.sys, and dosx.EXE.

Batch file

These commands direct the flow of Execution in batch files; for example, for, goto, if, and else.

Configuration

These commands go in AUTOEXEC.NT, CONFIG.NT, and CONFIG.SYS in the root drive. They tune the subsystem during startup.

The command interpreter (the shell) in Windows XP is, by default, CMD.EXE. The CMD.EXE command interpreter is similar to DOS's old COMMAND.COM shell but has enhanced batch file functions and also has built-in command-line editing and a command history function similar to that provided by DOSKEY in DOS and Windows 9x. You don't need DOSKEY in Windows XP, unless you want to use its command aliasing feature.

Many of the built-in commands are significantly enhanced since Windows 9x and NT 4. To see a complete list of command-line utilities along with syntax and usage examples, open the Help and Support Center and search for Command-line reference A-Z. Click each command for use, syntax, and examples.

TIP

To learn how to get the most from the scripting and the Command Line environment, get Brian's book Windows XP Under the Hood: Hardcore Windows Scripting and Command Line Power, published by Que.

What's New or Different from MS-DOS

Windows XP retains and enhances almost all the functionality of MS-DOS. The following sections explain new Windows XP commands not found in MS-DOS, changes to MS-DOS commands, and unavailable MS-DOS commands.

TIP

You can see the command line syntax and options for most commands by typing the command name followed by /? in a command prompt window. For example, rasdial /? lists the options for the rasdial command.

The online command line reference provides more detail. See the previous tip to find out how to view the command line reference.

Also, try typing help xxxx, where xxxx is the name of the program you're interested in. Some commands are documented this way.

Windows XP Commands

Table 25.5 lists most of Windows XP's command-line commands. Some may be used only by a Computer Administrator.

Table 25.5. Windows XP Command-Line Commands

Command

Function

Command

Function

arp

Displays and edits the ARP cache

cipher

Encrypts and decrypts files and folders

asr_fmt

Automated System Recovery backup and restore

clspack

Lists Java system packages

asr_ldm

Automated System Recovery Logical Disk manager

cmd

Command shell

assoc

Associates filename extensions with file types

compact

Enables and disables file and folder compression

atmadm

Manages ATM network connections

convert

Schedules the conversion of a volume from FAT to NTFS

attrib

Displays and sets file/folder attributes

cscript

Windows Script Host (command command-line version)

bootcfg

Modifies the BOOT.INI configuration file

defrag

Defragments a disk volume

cacls

Clears the Command Prompt window

diantz

Compress files into a .CAB file (same as makecab)

chkntfs

Schedules automatic chkdsk at boot time

diskpart

Manages disk partitions

diskperf

Starts the physical disk performance counters

getmac

Displays network adapter MAC addresses

driverquery

Lists the installed device drivers

goto

Goes to the label in a batch file

endlocal

Restores environment variables

gpresult

Computes and displays Group Policy Resultant Set of Policy

esentutl

MS database utility

gpupdate

Forces the update of Local and Group Policy settings

eventcreate

Adds an event to the event log

graftabl

Enables the display of graphics characters in the MS-DOS environment

eventquery

Lists events from the event log

graphics

Loads the graphics printer driver (obsolete)

eventtriggers

Displays and configures event triggers

grpconv

Program Manager Group converter

expand

Expands a file from a .CAB file

help

Displays command command-line program usage information

find

Finds text in files

hostname

Displays the local computer's TCP/IP hostname

findstr

Finds text in files using regular expressions

iexpress

Creates simple Installer applications

finger

Displays information about a user (UNIX)

if

Executes a command conditionally

for

Repeat command (many options)

ipconfig

Displays the TCP/IP configuration and manages DHCP leases

forcedos

Runs a program in the MS-DOS environment

ipsec6

Configures IPSec over IPv6 security

format

Formats a fixed or removable disk

ipvg

Installs and configures IPv6

fsutil

Manages the Windows file system

ipxroute

Displays and edits the IPX/SPX protocol's routing table

ftp

File Transfer Protocol

jdbgmgr

Microsoft debugger for Java

ftype

Associates file types to “open” commands

jview

Command-line loader for Java

label

Sets the volume label on a disk or mount point

mqbkup

MS Message Queue backup and restore utility

loadfix

Runs an program above the first 64KB of memory

mrinfo

Multicasts routing using SNMP

loadhigh

Loads an MS-DOS TSR program into high memory

mscdexnt

MS CD Extensions, loaded in AUTOEXEC.NT

lodctr

Installs, backs up, or restores performance performance-counter definitions

msg

Sends a message to anotheruser

logman

Schedules the automatic collection of performance information

nbtstat

Displays NetBIOS-over-TCP/IP statistics and name tables

logoff

Logs off from Windows

net

Networking management utility

lpq

Displays the printer queue (UNIX)

netsh

Network-configuration utility

lpr

Prints a file (UNIX)

netstat

Displays the current TCP/IP connections and open sockets

makecab

Compresses files into a .CAB file

nlsfunc

Loads country/region information

md

Creates a directory (same as mkdir)

nslookup

Query Queries DNS servers

mem

Displays free memory in the MS-DOS subsystem

ntsd

System-level debugger

mkdir

Creates a directory (same as md)

ntvdm

MS-DOS virtual machine environment

mode

Configures port, display, and keyboard settings

nw16

Netware NetWare 16-bit redirector, loaded in AUTOEXEC.NT

more

Displays text a page at a time

odbcconf

Configures ODBC drivers and data sources

mountvol

Creates, deletes, and lists volume mount points

openfiles

Displays files in use by local processes or network users

move

Moves files or folders

pagefileconfig

Manages the virtual memory pagefile

path

Sets the command search path

qprocess

Displays information about processes (local or remote)

pathping

Tests TCP/IP connectivity

qwinsta

Displays information about Terminal Services sessions

pause

Stops a batch file until the user presses Enter

rasautou

Creates a RAS connection

ping

Tests TCP/IP connectivity

rasdial

Starts and ends Dial-up Networking connections

ping6

IPv6 Ping

rasphone

Pop-up Dial-up Networking manager

popd

Restores the current directory

rcp

Copies files to another computer (UNIX)

print

Copies a file to a local LPT-port printer

rd

Removes a directory (same as rmdir)

prncnfg

Configures printers

recover

Extracts data from a damaged disk

prndrvr

Installs and lists print drivers

redir

Networking redirector, loaded in AUTOEXEC.NT

prnjobs

Manages print jobs

reg

Edits or displays Registry data

prnmngr

Manages local and network printer connections

regini

Creates Registry entries and sets permissions

prnport

Manages TCP/IP printers

regsvr32

Registers a .DLL file as a COM computer

prnqctl

Prints test pages, as well as starts and stops the printer queue

relog

Changes the format or rate for performance log files

prompt

Sets the command command-line prompt

rem

Remarks or comments text

proxycfg

Sets the HTTP Proxy server

ren

Renames files or folders (same as rename)

pubprn

Publishes printers to Active Directory

rename

Renames files or folders (same as ren)

pushd

Saves the current directory

replace

Replaces files

qappsrv

Displays the available application terminal servers on the network

reset

Deletes a Terminal Services session

rEXEc

UNIX remote execute

share

(Does nothing on Windows XP)

rmdir

Removes a directory (same as rd)

shift

Deletes and moves command command-line arguments

route

Displays or edits the current routing tables

shutdown

Shuts down, logs off, or restarts a computer

rsh

Remote shell (UNIX)

sort

Sorts text files alphabetically (filter)

rsm

Manages removable storage media pools

start

Runs a command or opens a document in a new window

runas

Runs a program with another user's credentials

subst

Maps a drive letter to a local folder

rundll32

Launches a 32-bit DLL program

syskey

Encrypts and secures the system database

rwinsta

Resets the session subsystem hardware and software to their known initial values

systeminfo

Displays a system hardware and software summary

sc

Displays and manages installed services

taskkill

Terminates a process

schtasks

Displays and manages scheduled tasks

tasklist

Lists active processes

sdbinst

Application compatibility database installer

telnet

Establishes a command-line session on another computer

set

Sets environment variables

tftp

Trivial File Transfer Protocol

setdebug

Enables and disables ActiveX debugging for Java

time

Displays and sets the time of day

setlocal

Saves the current environment

title

Sets the window title

setver

Lies about the MS-DOS version to old applications

tlntadmn

Telnet Server Administrator

sfc

Verifies system file integrity

tlntsess

Displays the current Telnet sessions

shadow

Monitors or controls a Terminal Services session

tracerpt

Gathers or summarizes event trace information

tracert

Checks TCP/IP connectivity

vssadmin

Displays shadow copy backups and providers

tracert6

IPv6 trace route

vwipxspx

NetWare protocol stack, loaded in AUTOEXEC.NT

tree

Displays the directory structure

wmic

Queries and manages Windows XP via Windows Management Instrumentation

tsdiscon

Disconnects a Windows/Terminal Services session

wscript

Windows Script Host (windowed version)

tskill

Terminates a process in a Terminal Services session

xcopy

Copies multiple files

tsprof

Copies and manages Terminal Services user profiles

&

Separates multiple commands on the command line.

tsshutdn

Shuts down or restarts a Terminal Services server profiles

&&

Separates multiple commands. Command following && runs only if the command preceding && succeeds

type

Copies a text file to the console window

|

Seperate commands. Output of the command preceding | is sent as input to command after |

typeperf

Displays performance data

||

Seperates commands. Command following || runs only if the command preceding || symbol fails

unlodctr

Removes performance performance-counter definitions

( )

Groups commands

verify

Controls automatic verify-after-write

; or,

Separates parameters

  

^

Escape character, removes special meaning from characters like & and |. For example, ^| is treated as ordinary text |

Changes to MS-DOS Commands

Table 25.6 lists some changes and improvements to command line programs that date back to MS-DOS.

Table 25.6. Changes to MS-DOS Commands in Windows XP

Command

Changed Features

chcp

This command changes code pages for full-screen mode only.

cmd

CMD.EXE replaces COMMAND.COM.

del

New switches provide many more functions.

dir

New switches provide many more functions.

diskcomp

Switches /1 and /8 are not supported.

diskcopy

Switch /1 is not supported.

doskey

DOSKEY has several enhancements. However, it functions with 32-bit Windows command line (console) applications only, and is not active in the 16-bit MS DOS environment.

format

Switches /b, /s, and /u are not supported. Adds new filesystem and cluster-size switches.

label

The symbols ^ and & can be used in a volume label.

mode

This command has had extensive changes.

more

New switches provide many more functions.

print

Switches /b, /c, /m, /p, /q, /s, /t, and /u are not supported.

prompt

New character combinations allow you to add ampersands ($a), parentheses ($c and $f), and spaces ($s) to your prompt.

recover

This command recovers files only.

rmdir

The new /s switch deletes directories containing files and subdirectories.

sort

This command does not require the TEMP environment variable. File size is unlimited.

xcopy

New switches provide many more functions.

I'll talk a bit more about some enhanced commands at the end of this chapter, under “Tips from the Windows Pros.”

Unavailable MS-DOS Commands

The MS-DOS commands in Table 25.7 are not available at the Windows XP command prompt.

Table 25.7. MS-DOS Commands Not Available in Windows XP

Command

New Procedure or Reason for Obsolescence

assign

Not supported in Windows XP.

backup

Not currently supported.

choice

Not currently supported.

ctty

Not currently supported.

dblspace

Not supported.

deltree

The rmdir /s command deletes directories containing files and subdirectories.

dosshell

Unnecessary with Windows XP.

drvspace

Not currently supported.

emm386

Extended memory support is provided for MS-DOS applications through EMM.SYS, which should appear in CONFIG.NT.

fasthelp

This MS-DOS 6.0 command is the same as the Windows XP command help. Windows XP also provides an online command reference.

fdisk

Disk Management prepares hard disks for use with Windows XP.

include

Multiple configurations of the MS-DOS subsystem are not supported.

interlnk

Not supported. Use the Network Connections Wizard to configure a direct connection via parallel, serial, or infrared (IR) ports.

intersrv

Not supported. Use the Network Connections wizard to configure a direct connection via parallel, serial, or infrared (IR) ports.

join

Filesystems can be joined from the Disk Management console.

memmaker

Windows XP automatically optimizes the MS-DOS subsystem's memory use.

menucolor

Multiple configurations of the MS-DOS subsystem are not supported.

menudefault

Multiple configurations of the MS-DOS subsystem are not supported.

menuitem

Multiple configurations of the MS-DOS subsystem are not supported.

mirror

Not supported in Windows XP.

msav

Not supported.

msbackup

Windows XP provides the optional NTBackup utility (under the Administrative Tools in the Control Panel) for computers with tape drives or the xcopy command for computers without tape drives. Install NTBackup from the 3RDPARTYMSFTNTBACKUP folder of the Windows XP CD-ROM.

mscdex

CD-ROM support for MS-DOS applications is provided by mscdexnt, run within AUTOEXEC.NT.

msd

You can use the System Information snap-in instead. To start System Information, choose Start, Run, and then type msinfo32. System Information is much more accurate and much more complete than msd.

numlock

Not currently supported.

power

Not supported.

restore

Not currently supported.

scandisk

Not supported.

smartdrv

Windows XP automatically provides disk caching for the MS-DOS subsystem.

submenu

Multiple configurations of the MS-DOS subsystem are not supported.

sys

Windows XP does not fit on a standard 1.2MB or 1.44MB floppy disk.

undelete

Not supported in Windows XP.

unformat

Not supported in Windows XP.

vsafe

Not supported.

Troubleshooting

Adjusting Program Settings

I can't get my Windows 95 program to work, even if I use the Program Compatibility Wizard.

The Program Compatibility Wizard isn't a cure-all for program compatibility problems, although it can help many otherwise-incompatible programs to run.

Before you decide you simply can't use the program at all with Windows XP, try the following:

  1. Adjusting Program Settings
  2. Try using a different Windows version when you run the compatibility wizard—If your program specifies “Windows 95 or Windows NT 4.0,” for example, try both compatibility mode settings before you give up.

  3. Reinstall the program—it's possible that when Windows XP was installed that your program's installation was damaged.

  4. Be sure you have installed the latest patches and updates from the program vendor.

These same steps will help you with any program compatibility problem you encounter.

MS-DOS Program Can't Open Enough Files

When I run my MS-DOS application, I get the error “Too Many Files Open” or a similar message.

By default, MS-DOS applications run by the VDM are allowed to open only 20 files. Some older programs, especially database programs, want to open more. In DOS or Windows 9x, you'd have added the line

FILES=100

to your config.sys file. In Windows XP, you must add this line to your CONFIG.NT file. Use Search to find this file on your computer, or look in WINDOWSSYSTEM32. Of course, if you specified an alternate setup file for this application, you'll want to change that file rather than CONFIG.NT.

MS-DOS Application Displays Garbage Characters

When I run an old MS-DOS application, I see lots of junk characters on the screen, and many occurences of “←[.

Some older programs that displayed text on the computer screen depended on the assistance of a display driver program called ansi.sys. Ansi.sys isn't installed by default in CONFIG.NT, so you're seeing the control message that your program was intending for ansi.sys to interpret; these should have resulted in color changes or cursor movements.

You need to add the line

device=ansi.sys

to your CONFIG.NT file. Use Search to find this file on your computer, or look in WINDOWSSYSTEM32. Of course, if you specified an alternate setup file for this application, you'll want to change that file rather than CONFIG.NT.

NOTE

If you're a software developer, you should know that when ANSI.SYS works for MS-DOS applications only. There is no support for ANSI escape sequences for Win32 console applications.

Tips from the Windows Pros: Getting More Out of the Command Prompt with Command Extensions

If you grew up with MS-DOS, like I did, you might find that even Windows XP's many enhancements to Windows aren't enough to keep you out of command-prompt-land permanently.

Believe it or not, you still can't make a printout of the files and folders stored in a given folder from Windows Explorer. And, when it comes to switching drives and folders, the command is quicker than the mouse.

If you want to move around your system faster than Explorer can do it, take advantage of the enhancements to Prompt provided by the Command Extensions activated by default with Windows XP Professional.

Command Extensions make lots of your favorite command-line utilities a lot more powerful in Windows XP Professional than they were in Windows 9x/Me.

Command extensions can be turned off by typing the command cmd /y and pressing Enter at a command prompt. To turn them back on again, type cmd /x and press Enter.

Commands Affected by Command Extensions

When command extensions are enabled, the following commands have new features or are available for use:

  • assoc [*]

  • call

  • cd or chdir

  • color [*]

  • del or erase

  • endlocal

  • for

  • ftype [*]

  • goto

  • if

  • md or mkdir

  • popd

  • prompt

  • pushd

  • set

  • setlocal

  • shift

  • start

If you like to write batch files, you'll find that changes to the FOR command alone will make your head spin with possibilities. Type help for >x & notepad x to read all about it.

In the following sections, you'll see how to use some of the other enhanced commands to get more done at the command-prompt level.

TIP

For a list of valid commands at the command prompt, type help | more and press Enter.

Command Extensions Make cd (Change Directory) Easier

The cd (Change Directory) and md (Make Directory) commands allow you to change to a different folder and make a new folder from the command prompt as an alternative to using Windows Explorer.

When command extensions are enabled, you can change to a long directory (folder) without putting quote marks around the name:

cd My DocumentsMy MusicMy MP3s

Without command extensions, you'd need to enter the following command:

cd "My DocumentsMy MusicMy MP3s"

Forget the quotes, and you'd see an error message.

Normally, md (Make Directory) can create just one folder (directory) at a time. When command extensions are enabled, you can create a nested series of folders with a single command. For example, this single command creates a series of folders below your current folder. You could use a command like this within the My Documents folder to create folders for your home budget:

md "My Budget4th QuarterTravel"

(Yes, you need the quote marks!)

Command Extensions Make PROMPT More Powerful

When you open a command-prompt session in Windows XP, the default prompt $p$g uses $p (current drive and path) and $g (greater-than sign) to display your current location:

C:Documents and SettingsAll Users>

However, if you've mapped a network drive to a drive letter, either with Windows Explorer or the command-prompt NET USE command, all you normally see is a drive letter when you change to the network drive:

S:>

When command extensions are enabled, you can use the following prompt command to display the server name (if any):

prompt $m$p$g

Now, the prompt will display the true network path and the drive letter you're using to access it.

Figure 25.16 shows you how this special prompt command makes life easier for you when you work with network drives.

Using prompt $m$p$g to display the actual path to a mapped network drive.

Figure 25.16. Using prompt $m$p$g to display the actual path to a mapped network drive.

Command Extensions Can Change the Color of the Command Prompt Window

Very experienced DOS users might remember when the ANSI.SYS device driver and complex batch file commands were needed to change the screen color in a command-prompt session. When command extensions are enabled, you can use the COLOR command to do the same thing. And, if you want to use more than one command-line session at the same time, you can color-code each one.

To see a complete list of the color codes you can use, type color /? and press Enter.

Here are two examples:

To change the color of the screen to light blue and the text to light aqua (very easy on the eyes), enter color 9B.

To reset the screen color to its original colors, enter color by itself.

The color command affects on only the current command prompt window. If you later open a new window, the colors are reset to the defaults set on the Color tab of the command prompt window's properties page.



[*] Commands available only when command extensions are enabled.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.206.68