Windows 7 : Command-Line and Automation Tools - The MS-DOS Environment

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
2/16/2013 8:34:13 PM
If you still use MS-DOS programs, you’ll be glad to know that the 32-bit versions of Windows 7 still support MS-DOS programs.


The MS-DOS and 16-bit Windows subsystems are not provided with the 64-bit versions of Windows. If you use a 64-bit version of Windows 7 and still need to run MS-DOS or Windows 3.1 applications, you can download and install the free Microsoft Virtual PC program from, or use VMWare from With either of these programs, you can set up a “virtual” computer, install a copy of MS-DOS, Windows 3.1, or any subsequent version of Windows, and run your older applications inside the simulated environment.

Be sure to install Virtual PC’s “Guest Extensions” inside the hosted operating system—these provide important enhancements. For example, they allow you to cut and paste between programs running inside and outside the virtual computer. This isn’t quite as effortless as the built-in support provided by 32-bit versions of Windows, but it works very well.

If you have Windows 7 Professional, Ultimate, or Enterprise edition, you might also be able to use MS-DOS applications installed in the Virtual XP system, which is a free download you can get from Microsoft.

Windows 7 and all other versions of Windows based on Windows NT run MS-DOS applications inside a program called ntvdm, which stands for Windows NT Virtual DOS Machine. Ntvdm is also used by the Windows 3.x support environment. It simulates the environment that DOS programs expect and makes them work correctly under Windows.

Ntvdm runs automatically when you attempt to start an MS-DOS or 16-bit Windows program. You don’t have to take any special steps to activate it, but you can tune it in several ways by doing the following:

  • Configure user variables in the Environment Variables dialog box.

  • Make selections from the DOS window’s control menu.

  • Make settings in the Properties dialog box for a shortcut to the DOS application.

  • Set up custom autoexec.nt and config.nt configuration files so that you can address special memory, driver, or environment variable requirements a DOS program might have.

  • Enter environment-altering commands at the command prompt.

MS-DOS App Says Too Many Files Open

If you run an MS-DOS application and it gives an error message saying there are too many files open, you must modify config.nt (or create a custom config file). You should change the line that reads, for example, files = 40 to a larger number; for example, files = 100.

MS-DOS Application Displays Strange Characters

If your older MS-DOS application displays lots of strange characters on the screen, especially the combination ◊[, your program expected the support of a display driver called ansi.sys. You need to add the following line to your config.nt file.


Editing Advanced Settings for a DOS Application

If you’re experiencing difficulties while running a specific DOS program, you can fine-tune the VDM environment for the particular application, allowing it to run more smoothly, or in some cases simply allowing it to run at all. 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) 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

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

Find the program file or a shortcut to it.

Right-click and choose Properties.


If the program is stored on an NTFS-formatted partition, the standard Security tab will also be listed in the Properties dialog box.

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.


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 when you move the mouse back to the Windows desktop. No DOS-based mouse driver is needed. Mouse support is provided automatically.

Customizing autoexec.nt and config.nt

You can choose to further configure the MS-DOS and Windows 3.x environment by modifying Windows 7’s equivalent of the old CONFIG.SYS and AUTOEXEC.BAT files. These files are called config.nt and autoexec.nt and are used to configure each DOS VDM when it starts up. Just remember:

  • The files CONFIG.SYS and AUTOEXEC.BAT in your hard drive’s root folder are completely ignored by Windows 7. If they’re there at all, it’s 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 \windows\system32 are used, but only when Windows needs to start up an MS-DOS or Windows 3.x application. Any change to these files will take effect the next time you start the application—you don’t need to restart Windows.

The standard settings in config.nt as set up when Windows 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 file might be different because the installer might have retained some of your previous operating system’s settings.)

dos=high, umb

You can edit the config.nt and autoexec.nt files with a simple text editor such as Notepad. They’re protected files, however, so you must run an elevated version of Notepad, using this procedure:

Click Start, All Programs, Accessories.

Right-click Notepad and select Run As Administrator.

Confirm the UAC prompt, or enter an Administrator password as requested. (Alternately, you can just type notepad in an elevated Command Prompt window).

Click File, Open, and browse to \windows\system32. Select autoexec.nt or config.nt as desired.


On my computers, I always change the files setting to files=100 and add the line


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

Most of the settings used in MS-DOS 6 still work in config.nt, with some changes as noted in Table 1.

Table 1. Enhanced Settings for config.nt
device=Installs loadable device drivers. Drivers that attempt to address hardware directly likely won’t work; however, you can load display drivers such as ANSI.SYS and memory managers such as EMM.SYS and HIMEM.SYS.
dosonlyAllows only DOS programs to be loaded from a COMMAND.COM prompt. Windows and UNIX programs won’t run.
echoconfigTells the VDM to print CONFIG and AUTOEXEC commands as they are executed from the files.
files=Sets the maximum number of open files. I recommend setting this to 100.
ntcmdpromptReplaces the COMMAND.COM interpreter with the 32-bit Windows command interpreter, cmd.exe. After you load a TSR or when you shell out of an application to DOS, you will get cmd.exe instead, from which you have the added benefits of the full 32-bit interpreter.

If you want, you can create customized copies of config.nt and/or autoexec.nt and use them just with specific DOS programs. To do this:

Use an elevated copy of Notepad to create the new setting file(s) with different names. For example, you might save a modified config.nt as config_wordperfect.nt.

Locate the MS-DOS program’s .exe or .com file icon in Windows Explorer.

Right-click the icon and select Properties. Select the Program tab, and click the Advanced button. Enter the path to your customized config file.


Editing these files properly is no piece of cake. I suggest you have at hand a good DOS reference, such as Que’s Special Edition Using DOS 6.22, Third Edition. It’s out of print, but you can get a used copy at, among other places.

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.


If you make changes to autoexec.nt or config.nt after having run an MS-DOS program from a Command Prompt window, you must close the Command Prompt window and open a new one for the MS-DOS subsystem to reload and take on the new configuration.

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, no ANSI cursor support is 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.

Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us