Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Displays one screen of output at a time.
The more command reads standard input from a pipe or redirected file and displays one screen of information at a time. This command is commonly used to view long files.
On This Page
Syntax
Move
Msav
Msbackup
Mscdex
Msd
Nlsfunc
Numlock
Path
Pause
Power
POWER.EXE
Print
Prompt
Qbasic
RAMDRIVE.SYS
Rem
Rename (ren)
Syntax
more < [drive**:**][path]filename
command-name | more
Parameters
[drive:][path]filename
Specifies the location and name of a file that supplies data you want to display.
command-name
Specifies the command that supplies data you want to display.
Note
When using the redirection character (<), you must specify a filename as the source. When using the pipe (|), you can use such commands as dir, sort, and type. Before using a pipe for redirection, you should set the TEMP environment variable in your AUTOEXEC.BAT file.
Examples
Suppose you have a long file named CLIENTS.NEW that you want to view on your screen. Either of the following two commands redirects the file through the more command to begin displaying the contents of the file:
more < clients.new type clients.new | more
The more command displays the first screen of information from CLIENTS.NEW and then prompts you with the following message:
— More —
You can then press any key to see the next screen of information.
Related Commands
For information about displaying the contents of a directory, see the dir command.
For information about displaying the contents of a file, see the type command.
Move
Moves one or more files to the location you specify. The move command also renames directories.
Syntax
move [drive**:][path]filename[,[drive:**][path]filename[...]] destination
Parameters
[drive:][path]filename
Specifies the location and name of the file or files you want to move. Also specifies the name of a directory you want to rename.
destination
Specifies the new location of the file, or the new name of the directory. The destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also specify a filename if you want to rename the file when you move it. Moving a file to an existing file overwrites the existing file. If you are moving more than one file, the destination must be a directory name.
Notes
Renaming a file while moving it
If you move only one file to a new directory, you can rename the file as you move it by specifying the new filename in the destination. However, if you move more than one file to a new directory in the same command line, you cannot specify a filename as a destination. If you specify a destination filename and the file already exists, the move command will overwrite the existing file without prompting you.
If you specify a filename when moving more than one file, you will see the following message:
Cannot move multiple files to a single file
Renaming a directory using the move command
You can rename a directory using the move command. Specify the old directory name as the file you want to move, and then specify the new directory name as the destination. You can change the directory name, but you cannot move the directory to another location in the directory tree.
For example, to rename a directory called NEW on drive C to OLD, type the following command:
move c:\new c:\old
The following command is invalid because the new directory name is not in the same location as the old directory name:
move c:\new c:\dos\new
Errorlevel parameters
If the move command successfully moved the file or files you specified, it returns an errorlevel value of 0. If there was an error in moving one or more of the files you specified, the move command returns an errorlevel value of 1.
Examples
Suppose C:\LETTERS is a directory. To move the files ED.TXT and SIGRID.TXT from the current directory to the LETTERS directory on drive C, type the following at the command prompt:
move ed.txt,sigrid.txt c:\letters
To move the BILL.TXT file from the current directory to the LETTERS directory on drive C and rename it ANN.TXT, type the following at the command prompt:
move bill.txt c:\letters\ann.txt
To rename the THISYEAR directory on drive C to LASTYEAR, type the following at the command prompt:
move c:\thisyear c:\lastyear
Msav
Scans your computer for known viruses.
Syntax
msav [drive**:] [/s** | /c] [/r] [/a | /l] [/n] [/p] [/f] [/video]
Parameters
drive* **:*
Specifies the drive that msav scans for viruses. If you do not specify a drive, msav scans the current drive.
Switches
/s
Scans the specified drive, but does not remove viruses that msav finds.
/c
Scans the specified drive, and removes viruses that msav finds.
/r
Creates an MSAV.RPT file that lists the number of files msav checked for viruses, the number of viruses it found, and the number of viruses it removed. By default, msav does not create a report. When it does create MSAV.RPT, the file is placed in the root directory.
/a
Scans all drives except drive A and drive B.
/l
Scans all local drives except network drives.
/n
Displays the contents of an MSAV.TXT file, if it exists and it is located in the directory that contains the MSAV.EXE file. msav then scans the current drive or the drive you specify. msav does not use the graphical interface. If msav detects a virus, it returns exit code 86 instead of displaying a message on your screen.
/p
Displays a command-line interface instead of the graphical interface.
/f
Turns off the display of filenames that have been scanned. Use this switch only with the /n or /p switch.
/video
Displays a list of the switches that affect how msav is displayed. This list contains all of the following switches.
/25
Sets screen display to 25 lines. This is the default setting.
/28
Sets screen display to 28 lines. Use this switch with VGA display adapters only.
/43
Sets screen display to 43 lines. Use this switch with EGA and VGA display adapters.
/50
Sets screen display to 50 lines. Use this switch with VGA display adapters only.
/60
Sets screen display to 60 lines. Use this switch with Video 7 display adapters only.
/in
Runs msav using a color scheme, even if a color display adapter is not detected.
/bw
Runs msav using a black-and-white color scheme.
/mono
Runs msav using a monochromatic color scheme.
/lcd
Runs msav using an LCD color scheme.
/ff
Uses the fastest screen updating on computers with CGA display adapters. Using this switch may decrease video quality.
/bf
Uses the computer's BIOS to display video.
/nf
Disables the use of alternate fonts.
/bt
Allows use of a graphics mouse in Windows.
/ngm
Runs msav using the default mouse character instead of the graphics character.
/le
Exchanges left and right mouse buttons.
/ps2
Resets the mouse if the mouse cursor disappears or locks up.
Notes
CHKLIST.MS files
Microsoft Anti-Virus creates a CHKLIST.MS file in each directory you scan for viruses. The first time you scan a directory, Microsoft Anti-Virus records in the CHKLIST.MS file checksums for each program. During subsequent scans, it compares new checksums with the originals to determine if program files have changed. A difference in checksum values indicates a possible virus infection.
Real symptoms versus false alarms
Damaged programs, some memory-resident programs, and conflicts among device drivers can cause your computer to act as if it were infected by a virus when it is not. If you suspect your computer is infected, consider the possible causes for the symptoms you observe. Instead of a computer virus, a hardware or software problem is likely to be producing errors.
Check All Files option
When the Check All Files option is selected, AnitVirus for MS-DOS checks only files with the following extensions: .386, .APP, .BIN, .CMD, .DOM, .DLL, .DRV, .EXE, .FON, .ICO, .OV*, .PGM, .PIF, .PRG, .SYS.
MSAV.INI and the MSDOSDATA environment variable
When you start Anti-Virus for MS-DOS, it uses an initialization file named MSAV.INI to configure the program. To determine the location of the MSAV.INI file, Anti-Virus for MS-DOS first searches for the MSDOSDATA environment variable, which specifies the path to the initialization file. If this environment variable is not defined, the program searches for the MSAV.INI file in the directory from which you started Anti-Virus for MS-DOS. If the program does not find the file, the program creates it using default values and places it in the directory.
The MSDOSDATA environment variable is useful if you share the MSAV.EXE file with others, but use your own configuration for Anti-Virus for MS-DOS. For example, suppose the MSAV.EXE file is located in the root directory on drive P, a read-execute-only network server, and you want Anti-Virus for MS-DOS to use your own configuration when it starts. To specify that it use the MSAV.INI file located in the DOS directory on your drive C instead of the initialization file located on network drive P, add the following line to your AUTOEXEC.BAT file:
set msdosdata=c:\dos
To start Anti-Virus for MS-DOS, type the following at the command prompt:
p:\msav
Changes you make to the configuration of Anti-Virus for MS-DOS are saved in the MSAV.INI file located in the DOS directory on drive C.
Using the /n switch
If you specify the /n switch, msav displays the contents of an MSAV.TXT file, if it exists and it is located in the directory that contains the MSAV.EXE file. Msav then scans the current drive or the drive you specify. Msav does not use the graphical interface. If msav detects a virus, it returns exit code 86 instead of displaying a message on your screen.
Examples
To start msav using a black and white color scheme, and to specify that msav check all drives except drives A and B, type the following command:
msav /bw /a
To write a simple batch program named VIRUS that supports the msav exit code and the /s switch to scan the current drive, you can type the following commands by using MS-DOS Editor:
echo off rem Smith's msav command msav /s /n if errorlevel 86 goto virus if not errorlevel 86 goto none :virus echo MSAV has detected a virus on your current drive! goto exit :none echo MSAV found no viruses on your current drive. goto exit :exit
Msbackup
Backs up or restores one or more files from one disk onto another.
You can back up all files on a disk or files that have changed since your last backup, schedule backups so they are done automatically on a regular basis, and restore files that you have backed up.
Syntax
msbackup [setup_file] [/bw | /lcd | /mda]
Parameters
setup_file
Specifies the setup file that defines files to back up and the type of backup you want to perform. Msbackup creates a setup file when you save program settings and file selections. Setup files must have an SET extension. If you do not specify a setup file, msbackup uses DEFAULT.SET.
Switches
/bw
Starts msbackup using a black-and-white color scheme.
/lcd
Starts msbackup using a video mode compatible with laptop displays.
/mda
Starts msbackup using a monochrome display adapter.
Notes
Must start msbackup from a hard disk
Msbackup program files must be located on your hard disk. You cannot start msbackup from a floppy disk.
Backup catalogs
As part of the backup process, msbackup creates a backup catalog that contains information about the files you backed up. When you need to restore one or more files, you can load the backup catalog and easily select files from a backup set. The backup catalog includes information about the:
Backed-up disk's directory structure.
Names, sizes, and attributes of the directories and files that were selected.
Total number of files.
Total size of the backup.
Name of the setup file that was used.
Date the backup was made.
Msbackup gives each catalog file a unique name that helps you identify a backup set. Each character in the catalog name contains information about a particular backup set. For example, consider a typical catalog name such as CD20823A.FUL. Reading left to right, the character(s) in the filename mean the following:
Character(s) | Meaning |
---|---|
C | The first drive backed up in this set. |
D | The last drive backed up in this set. (If only one drive was backed up, this letter will be the same as the first drive that was backed up.) |
2 | The last digit of the year, as determined by the system date. In the example, the year is 1992. |
08 | The month the backup set was created. |
23 | The day of the month the backup set was created. |
A | The position in the sequence of this backup. If more than one backup of the same drive(s) is performed on the same day and the Keep Old Backup Catalogs option is set to On, MSBACKUP assigns a letter from A to Z to indicate the order in which the backups were performed (A is the first backup you created that day, B is the second, C the third, and so on). If the Keep Old Backup Catalogs option is set to Off, this alternates between A and B. |
FUL | The backup type — FUL indicates a full backup, INC indicates an incremental backup, and DIF indicates a differential backup. |
You can easily locate the catalog for a backup set by using the information contained in the catalog filenames, even if you have many catalog files in your directory.
Each time you perform a full backup using a specific setup file, msbackup creates a master catalog. The master catalog keeps track of all the backup catalogs made during the backup cycle. When the next full backup is performed and a new backup cycle begins, a new master catalog is created.
The master catalog is used if you need to restore a complete backup cycle. When you load the master catalog, the catalogs of all the backups that were created during the backup cycle are automatically merged. Then the latest version of each backed-up file can be automatically restored (or you can choose to restore an earlier version).
You can choose whether you want to keep all of the old catalogs or only the current catalogs on your hard disk. The catalogs will remain part of your backup sets.
When you back up files, msbackup places one copy of the backup catalog on your hard disk, and a second copy on the disk or network drive that contains your backup set.
Insufficient memory
If you receive a message stating that you have insufficient memory, do the following:
Make sure you have at lease 512K of memory on your computer.
Quit msbackup, remove all memory-resident programs from memory, and try using msbackup again.
Choose the Options button on the Backup screen to display the Disk Backup Options dialog box. Turn off the Compress Backup Data option and then choose OK.
The MSDOSDATA environment variable
Backup for MS-DOS uses the MSDOSDATA environment variable to determine the location of configuration information, backup sets, and catalogs. Backup for MS-DOS first searches for the MSDOSDATA environment variable. If this environment variable is not defined, the program searches the directory from which you started the program. If the program does not find the file, the program creates it using default values and places it in the directory.
The MSDOSDATA environment variable is useful if you share the Backup for MS-DOS program files with others, but use your own configuration. For example, suppose the program files are located on drive P, a read-and-execute-only network server, and you want to use your own configuration, backup sets, and catalogs. To specify that Backup for MS-DOS use the configuration information, backup sets, and catalogs located in the BACKUP directory on your drive C, add the following line to your AUTOEXEC.BAT file:
set msdosdata=c:\backup
To start Backup for MS-DOS, type the following at the command line:
p:\msbackup
Changes you make to the configuration of Backup for MS-DOS are saved in the BACKUP directory on drive C.
Example
Suppose you created a setup file named WEEKLY.SET that defines a weekly full backup procedure on specified files. To use this setup file, type the following at the command line:
msbackup weekly
Mscdex
Provides access to CD-ROM drives. Mscdex can be loaded from your AUTOEXEC.BAT file or from the command prompt. (The device driver that came with your CD-ROM drive must be loaded from your CONFIG.SYS file. For more information, see Notes.)
The mscdex command should not be used after Windows has started.
Syntax
mscdex /d:driver [/d:driver2... ] [/e] [/k] [/s] [/v] [/l:letter] [/m:number]
Parameters
/d:driver1[/d:driver2... ]
Specifies the driver signature of the first CD-ROM device driver. The driver1 parameter must match the parameter specified by the /d switch on the CONFIG.SYS command that starts the corresponding CD-ROM device driver.
The mscdex command must include at least one /d switch. To install additional CD-ROM device drivers, specify an additional /d switch for each device driver.
/e
Specifies that the CD-ROM driver be allowed to use expanded memory, if available, to store sector buffers.
/k
Specifies that MS-DOS should recognize CD-ROM volumes encoded in Kanji. By default, MS-DOS does not recognize Kanji CD-ROM volumes.
/s
Enables sharing of CD-ROM drives on MS-NET or Windows for Workgroups servers.
/v
Directs mscdex to display memory statistics when it starts.
/l:letter
Specifies the drive letter to assign to the first CD-ROM drive. If you have more than one CD-ROM drive, MS-DOS assigns additional CD-ROM drives subsequent available drive letters.
/m:number
Specifies the number of sector buffers.
Notes
The CD-ROM device driver must be loaded
Your CONFIG.SYS file must include a device or devicehigh command that loads the CD-ROM device driver that came with your CD-ROM drive. The CD-ROM driver's command line should include a /d:drivername parameter. This parameter assigns a driver name (also called a driver signature) to the CD-ROM device driver.
The mscdex command must include a /d:drivername parameter that matches the /d:drivername parameter on the CD-ROM device driver's command line. Mscdex uses the /d:drivername parameter to identify the correct CD-ROM device driver. The driver name is usually a name similar to MSCD000. Each CD-ROM device driver currently in use must have a unique driver name.
Limit on number of logical drives
The number of logical drive letters available on your computer can limit the number of CD-ROM drives you can have. The number of logical drives is determined by the lastdrive command in your CONFIG.SYS file. By the time mscdex loads, some of the available drive letters might be used by other programs, such as a network or DoubleSpace.
Examples
Loading and enabling a single CD-ROM device driver
This example shows the relevant CONFIG.SYS and AUTOEXEC.BAT commands for a computer with one CD-ROM drive.
The CONFIG.SYS file contains the following device command:
device=c:\devices\cdromdrv.sys /d:mscd000
This command loads the device driver CDROMDRV.SYS, which came with the CD-ROM drive. The AUTOEXEC.BAT file contains the following mscdex command:
c:\dos\mscdex /d:mscd000 /l:g
This command enables the device driver that has the driver signature MSCD000. The /e switch specifies that the driver be allowed to use expanded memory, if available. The /l:G switch assigns the drive letter G to the CD-ROM drive.
Loading and enabling more than one CD-ROM device driver
This example shows the relevant CONFIG.SYS and AUTOEXEC.BAT commands for a computer that has two CD-ROM drives from two different manufacturers.
The CONFIG.SYS file contains the following device commands:
device = c:\aspi\aspicd.sys /d:mscd000 device = c:\cdrom\tslcdr.sys /d:mscd001
Each command loads the device driver that came with that CD-ROM drive. The AUTOEXEC.BAT file contains the following mscdex command:
c:\dos\mscdex /d:mscd000 /d:mscd001 /l:j
This command enables both device drivers. The first driver has the driver signature MSCD000; the second has the driver signature MSCD001. The /l:J switch specifies that the first CD-ROM drive, MSCD000, will be drive J and the second CD-ROM drive will be drive K.
Msd
Provides detailed technical information about your computer.
Syntax
To use msd to create a report, use the following syntax:
msd [/i] [/f[drive**:][path]filename] [/p**[drive**:][path]filename] [/s**[drive**:**][path][filename]]
To run the msd program and examine technical information through its interface, use the following syntax:
msd [/b] [/i]
Parameters
[drive:][path]filename
Specifies the drive, directory, and filename to which you want to write the report.
Switches
/i
Specifies that msd not initially detect hardware. Use the /i switch if you are having problems starting msd or if msd is not running properly.
/f[drive:][path]filename
Prompts you for name, company, address, country, phone number, and comments, then writes a complete msd report to the file you specify.
/p[drive:][path]filename
Writes a complete msd report to the file you specify, without prompting you for information.
/s[drive:][path][filename]
Writes a summary msd report to the file you specify, without prompting you for information. If you do not specify any of the parameters, msd writes the report to the screen.
/b
Runs msd in black and white instead of color. Use the /b switch when you have a monitor that does not correctly display msd in color.
Notes
Information provided by msd
Whether you examine the information through msd's interface or through a report, the msd program can provide detailed technical information about your computer's:
Model and processor
Memory
Video adapter
Version of MS-DOS
Mouse
Other adapters
Disk drives
LPT ports
COM ports
IRQ status
Terminate-and-stay-resident (TSR) programs
Device drivers
Msd Button Options
The following is a brief description of the buttons that appear on msd's main screen:
Computer
Displays computer manufacturer, processor type, and bus type; ROM BIOS manufacturer, version and date; keyboard type; DMA controller configuration; and math coprocessor status.
Memory
Displays a map of the upper memory area (UMA) — the memory region from 640K to 1024K.
Video
Shows your video card manufacturer, model, and type; video BIOS version and date; and current video mode.
Network
Displays network-specific configuration information.
Operating System
Displays the operating system version, location of MS-DOS in memory, the drive the computer was started from, the current environment settings, and the path from which msd was run.
Mouse
Shows the MS-DOS mouse driver version, mouse type, mouse interrupt request line (IRQ) number, and other information specific to the configuration of the mouse.
Other Adapters
Displays the game card status for up to two game devices or joysticks.
Disk Drives
Displays the size and number of bytes free on local and remote drives.
LPT Ports
Displays the port addresses of all installed parallel ports, and dynamically displays the status of each port.
COM Ports
Displays the port addresses and current communications parameters of all installed serial ports, and displays the status of each port.
IRQ Status
Displays the configuration of the hardware IRQs.
TSR Programs
Displays the name, location in memory, and size of each program loaded in memory at the time msd was run.
Device Drivers
Displays the names of all device drivers installed at the time msd was run.
Examples
Starting the msd program
If you wanted to examine some of the technical information about your computer before calling Microsoft Product Support Services, you would start the msd program by typing the following at the command prompt:
msd
The msd program has an interface that makes it easy for you to access detailed technical information about your computer.
Creating a report
Before calling Microsoft Product Support Services, you could create a file called COMPUTER.TXT that contains a detailed technical report about your computer. To do this, you could type the following at the command prompt:
msd /p computer.txt
The COMPUTER.TXT file would contain the information about your computer.
If you want msd to create a detailed report about your computer and you wanted the report to include such information as your name, company, address, and phone number, you would type the following at the command prompt:
msd /f computer.txt
The msd program will prompt you for the information.
Nlsfunc
Starts the Nlsfunc program, which loads country-specific information for national language support (NLS).
You can use the nlsfunc command either from the command line or within your CONFIG.SYS file to support the use of country-specific information and character set (code page) switching.
Do not use the nlsfunc command while Windows is running. If you do, your computer might stop responding.
Syntax
nlsfunc [[drive**:**][path]filename]
In your CONFIG.SYS file, use the following syntax:
install=[[dos-drive**:**]dos-path]nlsfunc.exe [country-filename]
Parameters
[drive:][path]filenameorcountry-filename
Specifies the location and name of the file containing country-specific information. If you use this parameter in the install command, you must include the drive and directory.
[dos-drive:]dos-path
Specifies the location of NLSFUNC.EXE.
Note
The default value for [drive**:**][path]filename is defined by the country command in your CONFIG.SYS file. If no country command exists in CONFIG.SYS, Nlsfunc looks for COUNTRY.SYS in the root directory of the startup drive. Nlsfunc does not access the COUNTRY.SYS file until MS-DOS requests information from it. If MS-DOS cannot find the COUNTRY.SYS file when you install Nlsfunc, no error message is given. However, you will get an error message if you subsequently run a chcp command.
Examples
To use the default country-specific information found in the COUNTRY.SYS file, type the following command:
nlsfunc
Suppose you have a file called NEWCDPG.SYS that contains country-specific information. If you want to use the information from that file rather than from the COUNTRY.SYS file, type the following command:
nslfunc newcdpg.sys
Related Commands
For information about displaying the current character set (code page), see the chcp command.
For information about preparing a character set (code page), see the mode (set device code pages) command.
Numlock
Specifies whether the NUM LOCK key is set to on or off when your computer starts. You can use this command only in your CONFIG.SYS file.
Syntax
numlock=[on|off]
Parameters
on|off
If set to on, turns on the NUM LOCK key when MS-DOS displays the startup menu. If set to off, turns NUM LOCK off.
Example
To ensure that NUM LOCK is always on when the startup menu appears, include the following command in the [menu] block.
For example, the following menu block defines three menu items, sets the default item to "full_config," and sets NUM LOCK to on:
[menu] menuitem=base_config,Base configuration only menuitem=full_config,Normal configuration menuitem=network,Normal configuration with network menudefault=full_config numlock=on
Related Commands
The numlock command is one of six special CONFIG.SYS commands for defining startup menus and multiple configurations. The other commands are:
The menucolor command, which defines the color of the menu's text and screen background.
The menuitem command, which defines an item on the menu.
The menudefault command, which specifies the default menu item.
The submenu command, which defines a submenu.
The include command, which includes the contents of one configuration block in another. This command cannot be included in a menu block.
Path
Indicates which directories MS-DOS should search for executable files.
MS-DOS uses the path command to search for executable files in the directories you specify. By default, the search path is the current directory only.
Syntax
path [[drive**:]path[;**...]]
To display the current search path, use the following syntax:
path
To clear all search-path settings other than the default setting (the current directory), use the following syntax:
path ;
Parameters
[drive:]path
Specifies a drive, directory, and any subdirectories to search.
;
When used as the only parameter, clears all search-path settings and specifies that MS-DOS is to search only the current directory.
Notes
Current directory searched first
MS-DOS always searches in the current directory first, before it searches directories in the search path.
Length limit for the path command
The maximum length of the path command is 127 characters. To fit more directories in the search path, you can shorten directory names, use the subst command to redirect directories to logical drives (which shortens the entries on the path command line), or use the append /x:on command.
Files with the same name, different extensions
You might have some files in the same directory that share the same filename but have different extensions. For example, you might have a file named ACCNT.COM that starts an accounting program and another file named ACCNT.BAT that connects your system to the accounting system network.
MS-DOS searches for a file by using default filename extensions in the following order of precedence: .COM, .EXE, and .BAT. To run ACCNT.BAT when ACCNT.COM exists in the same directory, you must include the .BAT extension on the command line.
Two or more identical filenames in the path
You might have two or more files in the search path that have the same filename and extension. MS-DOS searches for the specified filename first in the current directory. Then it searches directories in the order in which they are listed in the path command.
Specifying multiple directories in path command
To specify more than one path for MS-DOS to search, separate entries with a semicolon (;).
Using path in your AUTOEXEC.BAT file
If you place the path command in your AUTOEXEC.BAT file, MS-DOS automatically initiates the specified search path every time you start your computer.
Example
The following command specifies that MS-DOS is to search three directories to find commands (the three paths for these directories are C:\USER\TAXES, B:\USER\INVEST, and B:\BIN):
path c:\user\taxes;b:\user\invest;b:\bin
Related Command
For information about setting a search path for data files, see the append command.
Pause
Suspends processing of a batch program and displays a message that prompts the user to press any key to continue. You can use this command only within batch programs.
Syntax
pause
Notes
Prompting the user to continue the program
MS-DOS displays the following message in response to the pause command:
Press any key to continue . . .
Dividing a batch file into sections
If you press CTRL+C to stop a batch program, MS-DOS displays the following message:
Terminate batch job (Y/N)?
If you press Y (for yes) in response to this message, the batch program ends and control returns to the operating system. Therefore, you can insert the pause command before a section of the batch file you may not want to process. While pause suspends processing of the batch program, you can press CTRL+C and then Y to stop the batch program.
Example
Suppose you want a batch program to prompt the user to change disks in one of the drives. To do this, you might create the following file:
@echo off :begin copy a:*.* echo Please put a new disk into drive A pause goto begin
In this example, all the files on the disk in drive A are copied to the current directory. After the displayed comment prompts you to place another disk in drive A, the pause command suspends processing so that you can change disks and then press any key to resume processing. This particular batch program runs in an endless loop. The goto begin command sends the command interpreter to the begin label of the batch file. To stop this batch program, press CTRL+C and then Y.
Power
Turns power management on and off, reports the status of power management, and sets levels of power conservation.
Syntax
power [adv[:max|reg|min]|std|off]
To display the current power setting, use the following syntax:
power
Parameters
adv[:max|reg|min]|std|off[:max|reg|min]
Conserves power when applications and hardware devices are idle. In some cases, performance may be affected if an application is active instead of idle. Use max for maximum power conservation. Use reg, the default setting, to balance power conservation with application and device performance. Use min if the performance of an application or device is not satisfactory when you specify max or reg.
std
If your computer supports the Advanced Power Management (APM) specification, std conserves power by using only the power-management features of your computer's hardware. If your computer does not support the APM specification, std turns off power management.
off
Turns off power management.
Note
You must use the device command in your CONFIG.SYS file to install the POWER.EXE device driver before you can use the power command.
Related Command
For information about the Power device driver, see POWER.EXE.
POWER.EXE
Reduces power consumption when applications and devices are idle. The power manager device driver conforms to the Advanced Power Management (APM) specification. This device driver must be loaded by a device command in your CONFIG.SYS file.
Syntax
device=[drive**:][path]power.exe [adv[:max|reg|min]|std|off] [/low**]
Parameters
drive* : *path
Specifies the location of the POWER.EXE file.
adv[:max|reg|min]|std|off[:max|reg|min]
Conserves power when applications and hardware devices are idle. In some cases, performance may be affected if an application is active instead of idle. Use max for maximum power conservation. Use reg, the default setting, to balance power conservation with application and device performance. Use min if the performance of an application or device is not satisfactory when you specify max or reg.
std
If your computer supports the Advanced Power Management (APM) specification, std conserves power by using only the power-management features of your computer's hardware. If your computer does not support the APM specification, std turns off power management.
off
Turns off power management.
Switch
/low
Loads the POWER.EXE device driver into conventional memory, even if the upper memory area is available. By default, POWER.EXE is loaded into the upper memory area if the upper memory area is available.
Example
To specify that POWER.EXE is located in the DOS directory of drive C and that the default setting be used, add the following command line to your CONFIG.SYS file:
device=c:\dos\power.exe
The POWER.EXE device driver will be loaded into the upper memory area, if it is available.
Related Command
For information about reducing power consumption, see power.
Prints a text file while you are using other MS-DOS commands.
This command can print in the background if you have an output device connected to one of your system's serial or parallel ports.
Syntax
print [/d:device] [/b:size] [/u:ticks1] [/m:ticks2] [/s:ticks3] [/q:qsize] [/t] [[drive**:][path]filename[ ...]] [/c**] [/p]
To install print with the default parameters or to display the contents of the print queue on your screen without affecting the queue, use the following syntax:
Parameters
[drive:][path]filename
Specifies the location and name of a file or set of files you want to print. You can include multiple files (usually as many as 10) on one command line.
Switches
/d:device
Specifies the name of the print device. Valid values for parallel ports are lpt1, lpt2, and lpt3. Valid values for serial ports are com1, com2, com3, and com4. The default value is lpt1, which is also called prn. The /d switch must precede any filename used on the command line.
/b:size
Sets the size (in bytes) of the internal buffer, which is used to store data before it is sent to the printer. The minimum and default value for size is 512; the maximum value is 16384. Increasing this value decreases the amount of memory available for other purposes but may speed up the print command.
/u:ticks1
Specifies the maximum number of clock ticks print is to wait for a printer to be available (clock ticks occur about 18 times per second). If the printer is not available within the time specified, the job does not print. Values for ticks1 must be in the range 1 through 255. The default value is 1.
/m:ticks2
Specifies the maximum number of clock ticks print can take to print a character on the printer. Values for ticks2 must be in the range 1 through 255. The default value is 2. If a character is printed too slowly, MS-DOS displays an error message.
/s:ticks3
Specifies the number of clock ticks the MS-DOS scheduler allocates for background printing. Values for ticks3 must be in the range 1 through 255. The default value is 8. Increasing this value can speed up printing while slowing down other programs.
/q:qsize
Specifies the maximum number of files allowed in the print queue. Values for qsize must be in the range 4 through 32. The default value is 10.
/t
Removes all files from the print queue.
/c
Removes files from the print queue. You can use the /c and /p switches on the same command line.
When the /c switch precedes the list of filenames on the command line, it applies to all files whose names follow the /c switch, until print encounters a /p switch, in which case the /p switch applies to the file whose name precedes the /p switch.
When the /c switch follows a filename, it applies to the file whose name precedes the /c switch and all files whose names follow the /c switch, until print encounters a /p switch, in which case the /p switch applies to the file whose name precedes the /p switch.
/p
Adds files to the print queue. You can use the /c and /p switches on the same command line.
When the /p switch precedes the list of filenames on the command line, it applies to all files whose names follow the /p switch, until print encounters a /c switch, in which case the /c switch applies to the file whose name precedes the /c switch.
When the /p switch follows a filename, it applies to the file whose name precedes the /p switch and all files whose names follow the /p switch, until print encounters a /c switch, in which case the /c switch applies to the file whose name precedes the /c switch.
Notes
Length of a print queue entry
Each print queue entry can contain a maximum of 64 characters. Each queue entry includes the drive letter, directory, and any subdirectories.
Limitations on switches
You can only use the /d, /b, /u, /m, /s, and /q switches the first time you use the print command after starting MS-DOS. To use one of these switches after using print, you need to restart MS-DOS.
Use an application's print command when possible
Many applications have their own print commands. You should use an application's print command to print files that you create with the application.
Examples
To view the status of the print queue, type the following at the command prompt:
MS-DOS displays the name of the file being printed (if any), the names of files in the queue, and an error message, if an error condition exists.
The following command removes the PENCIL.TST file from the print queue:
print a:pencil.tst /c
The next command shows how to remove the file PENCIL.TST from the queue and add the file PEN.TST to the queue:
print pencil.tst /c pen.tst /p
The remaining examples use switches that work only with the first print command you use after starting MS-DOS.
The following command sets up the print queue for printing on LPT1:
print /d:lpt1
To specify that the print command is to wait 60 clock ticks for a printer to be available and that the MS-DOS scheduler is to allocate 25 clock ticks to the print command for background printing rather than the default value of 8 clock ticks, type the following command:
print /u:60 /s:25
The following example specifies that print has 4 clock ticks available to print each character rather than the default value of 2 clock ticks:
print /m:4
To change the default maximum number of files for the print queue, use the print command with the /q switch, as the following example shows:
print /q:32
Related Commands
For information about configuring a printer connected to a parallel port, see the mode (configure printer) command.
For information about displaying the status of a printer, see the mode (display device status) command.
For information about configuring a printer connected to a serial port, see the mode (redirect printing) command.
For information about preparing printers for character-set switching, see the mode (set device code pages) command.
Prompt
Changes the appearance of the command prompt.
You can customize the command prompt to display any text you want, including such information as the name of the current directory, the time and date, and the MS-DOS version number.
Syntax
prompt [text]
Parameters
text
Specifies any text and information you want included in your system prompt.
The following list shows the character combinations you can include instead of, or in addition to, any character string(s) in the text parameter. The list includes a brief description of the text or information that each character combination adds to your command prompt.
$q | = (equal sign) |
$$ | $ (dollar sign) |
$t | Current time |
$d | Current date |
$p | Current drive and path |
$v | MS-DOS version number |
$n | Current drive |
$g | > (greater-than sign) |
$l | < (less-than sign) |
$b | | (pipe) |
$_ | ENTER-LINEFEED |
$e | ASCII escape code (code 27) |
$h | Backspace (to delete a character that has been written to the prompt command line) |
Notes
Using the prompt command without the text parameter
When you use the prompt command without specifying a value for text, prompt resets the command prompt to the default setting — the current drive letter followed by a greater-than sign (>).
Using the $p value for text
If you include the $p character in the text parameter, MS-DOS reads your disk after you enter each command to determine the current drive and path. This can take extra time, especially for floppy disk drives.
Defining the MS-DOS command prompt in Windows
If you use Microsoft Windows 3.1, you can change the command prompt with the WINPMT environment variable.
For example, suppose you want the following message to precede the MS-DOS command prompt:
Type "exit" when you're ready to return to Windows.
To display this message, include the following command to your AUTOEXEC.BAT file:
set winpmt=Type "exit" when you're ready to return to Windows.$_$p$g
Examples
The following example sets the command prompt to display the current drive and path followed by the greater-than sign (>):
prompt $p$g
The following command displays a two-line prompt in which the current time appears on the first line and the current date appears on the second line:
prompt time is: $t$_date is: $d
If your CONFIG.SYS file loads ANSI.SYS, you can use ANSI escape sequences in your prompts. The following command, for example, displays your prompt in reverse video mode and returns to usual video mode for other text:
prompt $e[7m$n:$e[m
The characters following the escape code ($e) are ANSI escape sequences.
Related Commands
For information about setting the current date and time, see the date and time commands.
For information about ANSI escape sequences, see ANSI.SYS.
Qbasic
Starts MS-DOS QBasic, a program that reads instructions written in the Basic computer language and interprets them into executable computer code.
The QBasic program provides a complete environment for programming in the Basic language. QBasic includes extensive online Help. For more information about using QBasic, press ENTER immediately after starting QBasic or press F1 any time while running QBasic.
Syntax
qbasic [/b] [/editor] [/g] [/h] [/mbf] [/nohi] [[/run][drive**:**][path]filename]
Parameters
[drive:][path]filename
Specifies the location and name of the file to load when QBasic starts.
Switches
/b
Displays QBasic in black and white if you have a color monitor.
/editor
Invokes MS-DOS Editor, a full-screen text editor.
/g
Provides the fastest update of a CGA monitor.
/h
Displays the maximum number of display lines possible on your screen.
/mbf
Converts the built-in functions MKS$, MKD$, CVS, and CVD to MKSMBF$, MKDMBF$, CVSMBF, and CVDMBF, respectively.
/nohi
Allows the use of a monitor that does not support high-intensity video. Do not use this switch with Compaq laptop computers.
/run
Runs the specified Basic program before displaying it. You must specify a filename.
Notes
Cannot use MS-DOS Editor if MS-DOS QBasic is not present
To use MS-DOS Editor, you must have the QBASIC.EXE file in the current directory, or in the same directory as the EDIT.COM file in your search path. If you delete QBASIC.EXE to save space on your hard disk, you cannot use MS-DOS Editor.
Running consecutive Basic programs
You can run consecutive Basic programs from a batch file by using the Basic system statement and the qbasic command with the /run switch. A system statement quits qbasic and returns control to MS-DOS after a Basic program has run, instead of returning to QBasic. This allows you to run more than one Basic program from a batch file without having to intervene.
Display of shortcut keys
Some monitors may not support the display of shortcut keys by default. If your monitor does not display shortcut keys, use the /b switch (for CGA monitors) and the /nohi switch (for systems that do not support bold characters).
RAMDRIVE.SYS
Uses part of your computer's random-access memory (RAM) to simulate a hard disk drive. This device driver must be loaded by a device or devicehigh command in your CONFIG.SYS file.
RAM drives are much faster than hard disk drives because your computer can read information faster from memory than from a hard disk. A RAM drive appears to be a normal hard disk drive; you can use it just as you would any hard disk drive. The most important difference between a real disk drive and a RAM drive is that because it exists only in memory, information on a RAM drive is lost when you turn off or restart your computer. You can set up as many RAM drives as you want, up to the amount of memory your computer has. To do this, add one RAMDRIVE.SYS line to your CONFIG.SYS file for each additional RAM drive you want.
Syntax
device=[drive**:][path]ramdrive.sys [DiskSizeSectorSize [NumEntries]]] [/e** | /a]
Parameters
[drive:][path]
Specifies the location of the RAMDRIVE.SYS file.
DiskSize
Specifies how many kilobytes of memory you want to use for the RAM drive. For example, to create a 640K RAM drive, specify 640. If you don't specify an amount, RAMDrive will create a 64K RAM drive. You can specify a value from 4 to 32767. However, you cannot specify more memory than your system has available.
SectorSize
Specifies the disk sector size in bytes. The size can be 128, 256, or 512 bytes. (If you include a SectorSize value, you must also include a value for DiskSize.)
Generally, you should use the default sector size of 512 bytes.
NumEntries
Limits the number of files and directories you can create in the RAM drive's root directory. The limit can be from 2 to 1024 entries; the limit you specify is rounded up to the nearest sector size boundary. If you do not specify a limit, you can create up to 64 entries in the RAM drive's root directory. (If you include a value for NumEntries, you must also include values for DiskSize and SectorSize.)
If there is not enough memory to create the RAM drive as specified, RAMDrive will try to create it with a limit of 16 directory entries. This may result in a RAM drive with a different limit from the one you specified.
Switches
/e
Creates the RAM drive in extended memory.
For RAMDrive to use extended memory, your system must be configured so that it provides extended memory, and a device command for the extended-memory manager (such as HIMEM.SYS) must appear in your CONFIG.SYS file before the device command for RAMDRIVE.SYS. In general, it is best to create a RAM drive in extended memory if your system has extended memory.
/a
Creates the RAM drive in expanded memory.
For RAMDrive to use expanded memory, your system must be configured so that it provides expanded memory, and the device command for the expanded-memory manager (such as EMM386, 386MAX, CEMM, or QEMM) must appear in your CONFIG.SYS file before device command for RAMDRIVE.SYS.
Notes
Using conventional memory
Although specifying a memory type is optional, it is strongly recommended. If you omit both the /e and /a switches, RAMDRIVE.SYS uses your system's conventional memory. It is not a good idea to use conventional memory for a RAM drive, because this reduces available work space for programs. However, if you don't have extended memory, expanded memory, or a hard disk drive, you might want to use conventional memory for a RAM drive. A RAM drive can increase the speed of a floppy disk system significantly enough that it may be worth the loss of some conventional memory.
Using extended memory
If your system has extended memory installed (starting at the 1-megabyte boundary), you can use this extended memory for one or more RAM drives. For RAMDRIVE.SYS to use extended memory, you must first install HIMEM.SYS or another extended-memory manager that conforms to the Lotus/Intel/Microsoft/AST eXtended Memory Specification (XMS). In your CONFIG.SYS file, the device command that installs the XMS extended-memory manager must precede the commands that install the RAM drive.
Using expanded memory
For RAMDRIVE.SYS to use expanded memory, you must configure your system so that it provides expanded memory. In your CONFIG.SYS file, the device command that installs the expanded-memory manager (such as EMM386.EXE) must precede the device command that installs RAMDRIVE.SYS. The expanded-memory manager must conform to the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS).
Increasing the efficiency of a RAM drive
For the best results with a RAM drive, you can define a TEMP environment variable and set it to a directory on the RAM drive. If you use Windows, be sure the RAM drive is at least 2 MB in size; otherwise, there might not be enough space to create temporary files for printing.
Examples
To create a RAM drive in extended memory and allocate 64K (the default amount) of extended memory to RAMDRIVE.SYS, add the following line to your CONFIG.SYS file:
device=c:\dos\ramdrive.sys /e
This command loads RAMDRIVE.SYS from the C:\DOS directory.
Suppose you want to install RAMDRIVE.SYS in expanded memory and allocate 4 MB (4096K) of expanded memory to the RAM drive. To do this and to specify that RAMDRIVE.SYS is located in the DOS directory on drive C, add the following line to your CONFIG.SYS file:
device=c:\dos\ramdrive.sys 4096 /a
Now suppose you want to allocate 2048K of extended memory to RAMDRIVE.SYS and create a RAM drive that has 512-byte sectors and a limit of 1024 entries in its root directory. To do this and to specify that RAMDRIVE.SYS is located in the DEVICES directory on drive D, add the following line to your CONFIG.SYS file:
device=d:\devices\ramdrive.sys 2048 512 1024 /e
Rem
Enables you to include comments in a batch file or in your CONFIG.SYS file. The rem command is also useful for disabling commands. (You can use a semicolon (;) instead of the rem command in your CONFIG.SYS file, but not in batch files.)
Syntax
rem [string]
Parameters
string
Specifies any string of characters — the command you want to disable or the comment you want to include.
Notes
Using the echo command to display comments
The rem command does not display comments on the screen. You must use the echo on command in your batch or CONFIG.SYS file in order to display comments on the screen.
Restrictions on characters in batch-file comments
You cannot use a redirection character (> or <) or pipe (|) in a batch-file comment.
Using rem to add vertical spacing
Although you can use rem without a comment to add vertical spacing to a batch file, you can also use blank lines. MS-DOS ignores the blank lines when processing the batch program.
Examples
The following example shows a batch file that uses remarks for both explanations and vertical spacing:
@echo off rem This batch program formats and checks new disks. rem It is named CHECKNEW.BAT. rem echo Insert new disk in drive B. pause format b: /v chkdsk b:
Suppose you want to include in your CONFIG.SYS file an explanatory comment before the country command. To do this, add the following lines to CONFIG.SYS:
rem Set country code to France country=033
The following example shows a device command that has been disabled by using a semicolon (;) instead of the rem command:
;device=c:\dos\ramdrive.sys
Related Command
For information about displaying messages, see the echo command.
Rename (ren)
Changes the name of the file or files you specify.
You can rename all files matching the specified filename. You cannot use the rename command to rename files across drives or to move files to a different directory location. To rename subdirectories or move files, use the move command.
Syntax
rename [drive**:**][path]filename1filename2
ren [drive**:**][path]filename1filename2
Parameters
[drive:][path]filename1
Specifies the location and name of the file or set of files you want to rename.
filename2
Specifies the new name for the file or, if you use wildcards, the new names for the files. (You cannot specify a new drive or path.)
Notes
Using wildcards with rename
You can use wildcards (* and ?) in either filename parameter. If you use wildcards in filename2, the characters represented by the wildcards will be identical to the corresponding characters in filename1.
Rename will not work iffilename2already exists
If, for filename2, you specify a filename that already exists, rename displays the following message:
Duplicate file name or file not found
Examples
Suppose you want to change the extensions of all the filenames in the current directory that have the extension .TXT; for example, suppose you want to change the .TXT extensions to .DOC extensions. To make this change, type the following command:
ren *.txt *.doc
To rename a file named CHAP10 (on drive B) to PART10, type the following command:
ren b:chap10 part10
The newly renamed file PART10 remains on drive B.
Related Commands
For information about renaming directories, see the move command.
For information about renaming a disk, see the label command.
For information about copying files to a different drive or directory, see the copy command.
For information about copying entire directories to a new location, see the xcopy command.