Starting the Command Interpreter
The command interpreter is a special kind of application. When you open a command window, what you're really doing is starting the command interpreter. The command interpreter accepts your commands and does something with them. The command interpreter for Windows is CMD.EXE. This application is responsible for creating the command window, accepting your configuration commands, and providing access to the built-in commands such as the Dir command.
You can configure the command interpreter using five techniques in Windows. The first is to add command line switches to the CMD.EXE. This approach configures the command interpreter as a whole and you don't have much control over this particular change once the command interpreter is running. Of course, you can have a shortcut for each occasion that relies on different command line switch setups for each task.
The second configuration method is to change the content of Config.NT. The Config.NT file appears in the \Windows\System32 directory and the command interpreter calls on it to configure the command window environment. The Config.NT file changes the device drivers, number of files, the loading of the Virtual DOS Machine into upper memory, and other configuration issues.
TIP: The Windows directory can appear in many locations on a system. For example, it may not install on the C drive, but could use the D drive instead. In addition, the name can change some systems used Windows, some Win, some WinNT, and others still other names. To find the Windows directory on the local system, type Echo %SYSTEMROOT% and press Enter. You'll see the location of the Windows directory displayed at the command prompt. Once you know this information, you can find all of the other resources you need on the local machine because the Windows directory setup doesn't change much from system to system.
The third configuration method is to change the content of AutoExec.NT. This file is actually a batch file that you can modify as you would any other batch file. All of the techniques described in the "Creating Batch Files" section of the tutorial apply to this file. You can create any environment you want using the proper programming techniques. In fact, you could present the user with choices and act on those choices as part of configuring the environment.
The fourth configuration method is the Program Information File (PIF). The configuration information you provide for DOS applications using this file directly affect their execution. In fact, the PIF provides a means of specifying alternative Config.NT and AutoExec.NT files. Consequently, when your command line application requires a special environment in which to run, you can create it.
The fifth configuration method is manual command line changes. The "Managing Environment Variables with the Set Command" section of the tutorial discusses some of the changes you can make. However, you can make other changes using common command line utilities that you'll find in the sections that follow.
In this tutorial:
- CMD and BAT Files
- Starting the Command Interpreter
- Using the CMD Switches
- Working with the Command Interpreter in the Registry
- Modifying Config.NT
- Displaying the Config.NT Commands
- Modifying AutoExec.NT
- Saving Memory Using the LH Command
- Defining Application Compatibility with the SetVer Utility
- Using Common DOS Utilities
- Formatting a Disk with the Format Utility
- Terminating a Session Using the Logoff Utility
- Managing Environment Variables with the Set Command
- Managing Environment Variables with the SetX Utility
- Using Debugging Utilities
- Working at the Command Prompt
- Managing Usernames and Passwords with CmdKey
- Changing Screen Colors with the Color Command
- Obtaining Command Line Help with the Help Utility
- Creating Batch Files
- Using the Choice Command
- Using the For Command
- Using the Goto Command
- Using the Prompt Command
- Using the WaitFor Utility