Running Nonnative Applications in Windows 2000 Professional

You can start MS-DOS-based applications from My Computer , or the command prompt in the MS-DOS window.

Starting an MS-DOS-based Application

When you start an application, Windows 2000 looks at the binary type of the file to be run. It distinguishes between a 16-bit Windows-based application and an MS-DOS-based application, and starts the VDM with the correct parameters based on binary type. The following six settings in the _default.pif file establish the MS-DOS environment:

  • Expanded memory specificaton (EMS)

  • Extended memory specification (XMS)

  • Miscellaneous multitasking options (such as Windows shortcut keys)

  • Application shortcut key

  • Custom MS-DOS initialization files

  • Compatible Timer Hardware Emulation

To start an MS-DOS-based application at the command prompt using its PIF file, use the start command. For example, to start Myapp.exe using Myapp.pif, type:

start myapp

The first MS-DOS-based application that you start at the command prompt establishes the environment for all MS-DOS-based applications running in that window.

In a few cases, Windows 2000 might not recognize that an application is MS-DOS based. If an MS-DOS-based application fails to start, try starting it with the forcedos command. For example, to start the program Myprog in the D:\Oldapps directory, type the following at the command prompt:

forcedos /d oldapps myprog

Renaming VDMs

Each MS-DOS-based application runs in its own VDM. All the VDMs are named Ntvdm.exe by default, but you can apply new names to specific VDMs by editing the registry.

To rename a VDM

  1. Copy the file Ntvdm.exe to a new file and assign a different name.

  2. Use a registry editor to find the cmdline registry entry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW.

  3. The default value of cmdline is SystemRoot \System32\Ntvdm.exe. In this value, change ntvdm.exe to the name of your copy of Ntvdm.exe.



The registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and require that you reinstall Windows 2000. To configure or customize Windows 2000, use the programs in Control Panel or Microsoft Management Console (MMC) whenever possible.

When you start an MS-DOS-based application, it runs in a process with the name you specified in the registry.

The registry change takes effect without rebooting. Thus, you can change the registry before starting different MS-DOS-based applications and have each application start in a uniquely named process. For information about using the registry editor, see the registry information in Windows 2000 Professional Help.



To avoid changing the default name permanently, set the value of cmdline back to Ntvdm.exe when you are finished running MS-DOS-based applications.

Using TSR Programs

Windows 2000 supports MS-DOS-based TSR programs, also called pop-up or memory-resident programs. Like any MS-DOS-based application you run in Windows 2000, TSR programs run in the window where they are started and can be used only within that window. They function reliably only when running alone or with other MS-DOS-based applications.

If your application requires a TSR program, start the TSR program, and then start the application in the same command window. You can also create a custom startup file that starts the TSR program, and then specify it in the PIF file. For more information, see Configuring the MS-DOS Environment earlier in this chapter.



Starting a TSR program from Autoexec.nt or Config.nt is inefficient because the program is recopied each time you start an application that reads Autoexec.nt or Config.nt. Start the program just as you would any other application in Windows 2000.

Command Interpreter

When you run a TSR program or temporarily suspend an MS-DOS-based application to return to the command prompt, Windows 2000 runs (the command interpreter for MS-DOS) by default. This preserves the MS-DOS environment and lets you use the TSR program immediately. To return to Cmd.exe, type:

exit <enter>

When you quit an MS-DOS-based application, Windows 2000 returns to the Windows 2000 command interpreter, Cmd.exe.

The Dosonly Command

You can use the Windows 2000 dosonly command to disable applications other than MS-DOS-based applications. If they are not disabled, these applications can start at the prompt and disrupt a TSR program or suspend an MS-DOS-based application. You can include the dosonly command in either your Config.nt file or your custom startup file.

The Ntcmdprompt Command

When is running, some features of the Windows 2000 command prompt, such as the DOSKEY programs display of command history, are not available. If you prefer to run Cmd.exe after starting a TSR program or after starting the command prompt from within an MS-DOS-based application, you can use the ntcmdprompt command. You can include ntcmdprompt in either your Config.nt file or your custom startup file.



The TSR program might not be available when Cmd.exe is running.

Using an MS-DOS-based Application Mouse Cursor

Some MS-DOS-based applications use a mouse cursor that cannot be synchronized with the system mouse pointer used by Windows 2000. If the Windows 2000 system mouse pointer does not work as expected with an MS-DOS-based application, you can hide it, thereby returning control of the mouse cursor to the application. For more information, see Windows 2000 online Help.