Site hosted by Angelfire.com: Build your free website today!
Chapter 39: Running DOS Programs and Commands

PreviousChapterContentsGlossaryNext

Configuring the DOS Environment

Windows provides a long list of settings for customizing the environment for the Command Prompt window or for a DOS program. Nearly all the settings are parameters you can tweak to help a recalcitrant DOS program run in the Windows environment. More often than not, adjusting these settings won't be necessary.

Earlier versions of Windows put the settings for DOS programs into separate PIF files (program information files), and some programs still use them. Windows XP stores the settings in DOS initialization files, in Command Prompt properties, and in program properties.

note Although you can edit a program's properties while the program is running, most changes do not take effect until you close the program and run it again. (The main exception is changing fonts.)

DOS Initialization Files

Windows XP enables you to create a Config file to load drivers and an Autoexec file to run DOS commands before the program runs. Windows XP provides default versions of these DOS initialization files, called Config.nt and Autoexec.nt, which are located in the C:\Windows\System32 folder (assuming that Windows is installed in C:\Windows).

The Config file contains DOS VM configuration commands, as well as commands to load real-mode device drivers. Autoexec contains regular DOS commands to be run as soon as DOS has finished starting up. Although any DOS command is valid, the only command commonly used is SET, which defines environment variables used by some programs and drivers. Config.nt is read during the DOS startup process. Windows runs the commands from Autoexec.nt after processing Config.nt. These files can now be located anywhere, which improves DOS backward compatibility by allowing you to have several different versions of the files and selecting the one that best suits the program you want to run.

The Autoexec and Config files are text files, which you can edit with Notepad. Microsoft recommends that you leave the original Config.nt and Autoexec.nt unchanged, and create edited copies with other names, like Config.games and Autoexec.pcfile, for your various applications. See "Installing and Configuring DOS Programs" later in this chapter for how to create your own versions of the files for the DOS program you want to configure.

tip Read the Autoexec.nt and Config.nt files to start learning about how they work. They are both copiously commented.

Setting Command Prompt Window Properties

When a Command Prompt window is open, you can see and set its settings by clicking the System Menu button in its upper-left corner and choosing Properties. The settings on the various tabs of the Command Prompt Properties dialog box, shown in Figure 39-2, control the appearance and some operational aspects of a DOS program. Table 39-1 lists the settings by tab (left to right).
[figure]
Figure 39-2: The Options tab of the Command Prompt Properties dialog box

note Depending on whether you start the Command Prompt from the Start menu (by choosing Start | All Programs | Accessories | Command Prompt) or from the Run command (by choosing Start | Run, typing cmd, and pressing ENTER), you see a different Properties dialog box. Changing the settings for one does not affect the other.

Tab Setting Description
Options Cursor Size Specifies the size of the cursor, the flashing marker that draws attention to where your typing will appear. Small appears as a line. Medium appears as a thick line. Large is a block.
Options Command History Buffer Size, Number of Buffers, Discard Old Duplicates Every time you type a command, Windows stores it in a buffer. Use the UP-ARROW and DOWN-ARROW keys on your keyboard to cycle through commands. The Buffer Size setting specifies the number of command lines stored. Number of Buffers controls how many different Command Prompt windows have buffers simultaneously. Discard Old Duplicates deletes duplicate commands from the buffer.
Options Display Options Specifies the default window size: Windowed or Full Screen.
Options Edit Options Selects either QuickEdit mode (in which you use the mouse pointer to select text and move the cursor) or Insert mode (in which you can place additional text wherever the cursor is instead of overwriting what's already there).
Font Size Specifies the font size in pixels (dots).
Font Font Specifies the font.
Font Bold Fonts Displays the selected font in boldface.
Layout Screen Buffer Size Specifies the virtual size of the window.
Layout Window Size Specifies the physical size of the Command Prompt window. If the Screen Buffer Size is larger, scrollbars appear to allow you access to the information that doesn't fit in the window.
Layout Window Position Specifies the position of the window on the screen. Let System Position Window enables Windows to choose the position. If you want the Command Prompt window to appear in the same place every time it opens, deselect the check box and set the coordinates of the upper-left corner of the window; 0 indicates the left or top edge of the screen. The limits are determined by what resolution you have your display set to.
Colors Screen Text, Screen Background, Popup Text, Popup Background Allows you to select which settings appear in the Selected Color Values section and the color bar.
Colors Select Color Values Specifies the color of the selected item (see the previous setting). The row of colors below this setting do the same thing.
Table 1: Settings in the Command Prompt Properties Dialog Box

Choosing DOS Program Fonts

On the Font tab, shown in Figure 39-3, the Window Preview box shows you how big your window will be relative to the Windows screen, and the Selected Font box shows what the text in the window will look like. First, choose a font from the Font box, then choose from the sizes that are available for that font.
[figure]
Figure 39-3: Setting the font for the Command Prompt window

Controlling DOS Program Window Settings

On the Layout tab, shown in Figure 39-4, you can set the virtual and actual sizes of the window. The virtual size (set using the Screen Buffer Size setting) controls the amount of text that Windows stores for the window. The Window Size setting controls the actual size of the widow on the screen. If the Screen Buffer Size is larger than the Windows Size (the default is for it to be several times taller, but the same width), you can scroll up and down the buffer using the window's scrollbars.
[figure]
Figure 39-4: Specifying the Command Prompt window size and position

Setting DOS Program Colors

The Colors tab of the Command Prompt Properties dialog box, shown in Figure 39-5, controls the foreground and background colors of the text in the window. Select the item for which you want to set the color (Screen Text, Screen Background, Popup Text, or Popup Background) and then select a color for it from the bar of colors running across the middle of the dialog box. Your choices appear in the preview panes below. If you don't like the colors listed, you can adjust the Selected Color Values boxes to get the colors you like.
[figure]
Figure 39-5: Setting the text and background colors

Setting Executable and Shortcut Properties

Additional options for DOS programs are set in the program's Properties dialog box. To set them, find either the executable (.exe or .com) file for the program or a shortcut to the executable file (you may need to choose Start | Search to find it). Many DOS applications, especially games, come with more than one executable file. Along with the executable file that runs the program, other executable files may uninstall or configure the program. Once you've located the executable file that runs the program (or a shortcut to it), right-click the file or shortcut and choose Properties to see its Properties dialog box. Figure 39-6 shows the Memory tab of the dialog box.
[figure]
Figure 39-6: The memory options for a DOS program

Table 39-2 lists settings in the dialog box, except for those on the Font tab, which is similar to the Font tab in the Command Prompt Properties dialog box, described in Table 39-1. The Properties dialog box for a shortcut also includes a Summary tab, which isn't used for configuring programs.

Tab Setting Description
General Attributes: Read-only, Hidden, Archive Specifies the file attributes.
Program Cmd Line Specifies the command line that you would type at the command prompt. The first thing on the command line must be the filename of the program. Many programs let you put parameters, switches, and filenames in the command line as well. If you type a space followed by a question mark in this box, Windows prompts you for command-line data when you start the program and replaces the question mark with the data you type.
Program Working Specifies the name of the folder to use as the program's working folder. The program reads and writes its files from this folder unless the program specifically names a different folder.
Program Batch File Specifies the name of a DOS batch file to run before the program starts. This is rarely used.
Program Shortcut Key Specifies the key combination to start or activate the program. You can specify the CTRL or ALT key in combination with another key, or a plain function key. Any combination you specify as a shortcut can no longer be used as input by any other program running on your computer, so choose a combination that isn't commonly used.
Program Run Specifies whether Windows starts the program in a normal, minimized, or maximized window. Most DOS programs can't handle a maximized window.
Program Close on Exit Specifies whether Windows closes the window in which the program appears when the program exits.
Memory Conventional Memory: Total, Initial Environment Specifies the amount of memory (RAM) in kilobytes available to the program, up to DOS's limit of 640KB. For programs run in Windows 95 compatibility mode, the Initial Environment setting specifies the amount of memory reserved for the command-interpreter part of DOS itself. For most programs, leave these set to Auto.
Memory Protected Protects Windows' system memory from accidental modification by the DOS program and can keep a DOS program failure from crashing Windows. We recommend selecting this check box.
Memory Expanded (EMS) Memory, Extended (XMS) Memory, MS-DOS Protected-Mode (DPMI) Memory Specifies the amount of memory in kilobytes that Windows allocates as expanded, extended, or DPMI memory (three systems that DOS programs use to access more than 640KB).
Screen Usage: Full-screen, Window, Initial Size Specifies whether the program starts full-screen or in a window. For some programs, you can select 25, 43, or 50 text lines on the screen by setting the Initial Size box. (If you select more than 25, be sure that the program can handle the size you select.) The program may override these settings.
Screen Restore Settings at Startup Specifies whether Windows remembers changes that the program makes to the screen setup from one run of the program to another.
Screen Fast ROM Emulation Specifies whether the display driver provides video functions. Select this check box unless the screen display looks wrong.
Screen Dynamic Memory Allocation Maximizes the amount of memory available to other programs while this program is running.
Misc Allow Screen Saver Enables the Windows screen saver, even when this program is running.
Misc QuickEdit Causes any use of the mouse to mark text as though you had chosen the Mark command from the System Menu first. Check this box if your program makes no use of the mouse (though often Windows is able to automatically detect if the program can use a mouse or not and will disable the option appropriately).
Misc Exclusive Mode Dedicates the mouse to this program. Not recommended, since it makes the mouse unusable as the Windows pointer until the program exits. If you select it, switch the Command Prompt window to full-screen mode instead (by pressing ALT-ENTER), which makes the Windows mouse pointer vanish.
Misc Always Suspend Suspends this program whenever it's not the active window. Leave this box checked, unless the program does useful background activity.
Misc Warn If Still Active Specifies that Windows pop up a warning box if you try to close this program before it exits.
Misc Idle Sensitivity Specifies that Windows attempt to detect when an active DOS program is idle and waiting for keyboard input, so that Windows can give more processor time to other applications. High sensitivity makes Windows give more time to other applications. Leave this alone unless keyboard response to the program is sluggish, in which case, make the sensitivity lower.
Misc Fast Pasting Uses an optimized technique for pasting text into a Command Prompt window that fails with a few programs. If pasting doesn't work, turn this off.
Misc Windows Shortcut Keys Specifies which of the key combinations listed in this box perform Windows functions, even when Windows is running a DOS program. If your DOS application needs to use any of these combinations itself, uncheck the ones it needs.
Compatibility Run This Program in Compatibility Mode For Specifies whether to use compatibility mode. When selected, choose from Windows 95, Windows 98, Windows NT 4, and Windows 2000.
Compatibility Run in 256 Colors Sets the window to use 8-bit color.
Compatibility Run in 640 0xd7 480 Screen Resolution Sets the window to use 640 0xd7 480 (VGA) screen resolution.
Compatibility Disable Visual Themes Disables the Windows XP desktop theme for the window.
Table 2: Settings in the Properties Dialog Box for a Program or Shortcut

Controlling the Amount of Memory the Program Can Use

The Memory tab of the program's Properties dialog box (shown in Figure 39-6) controls how much memory is available to a program using each of the DOS addressing schemes. In nearly all cases, Windows automatically allocates an appropriate amount of each kind of memory to the program when it runs the program. A few programs fail if given as much memory as Windows makes available (at the time many DOS programs were written, most people never imagined that anyone would ever put as much as 4MB in a single PC). If this is a problem, determine the kind of memory that the program uses--expanded (EMS), extended (XMS), or MS-DOS Protected-Mode (DPMI)--and try limiting it to 8,192KB (the program's documentation or help files may specify what types of memory the program can use and the maximum amount of memory that the program can handle).

tip Be sure to select the Protected check box, to prevent the DOS program from inadvertently changing the part of memory used by Windows itself.

Setting the Compatibility Mode

New to Windows XP is the compatibility mode, which attempts to present an environment for software that expects to be run in a particular version of Windows. For example, Ignition (the classic racing game from Unique Development Studios) refuses to install on Windows XP without the Windows 95 compatibility mode. You set the program's compatibility mode on the Compatibility tab of the Properties dialog box for the executable file or shortcut, as shown in Figure 39-7.
[figure]
Figure 39-7: Configuring a program to run in compatibility mode

note You often must set the compatibility mode of both the installation program and the actual program for them to work properly. First, set the compatibility mode for the installation program and run it. Once the program is installed, find the installed executable program and give it the same compatibility mode. If it doesn't work the first time, try another mode.

DOS Programs vs. the Luna Desktop Theme

Applications written specifically for Windows XP use something called a manifest to work with the Luna (Windows XP) theme. A manifest is a file that describes how the application is to appear while using the Luna interface. Most recent applications that comply closely with the Win32 API (Application Programming Interface--a set of tools that define how applications work with Windows) typically work fine without a manifest, but some do not. If an application behaves unexpectedly or does not appear correctly, try selecting the Disable Visual Themes check box on the Compatibility tab of the Properties dialog box for the program. For example, Macromedia's Dreamweaver 4.0 Web site authoring program has custom toolbars that do not work well with Luna (some buttons are covered by the swoopy new interface).

PreviousChapterContentsGlossaryNext