JSI Tip 3201. What are the Recovery Console commands?

Jerold Schulman

December 28, 2000

7 Min Read
ITPro Today logo in a gray background | ITPro Today


In tip 2037 What can I do with the Windows 2000 Recovery Console?, I introduced the Recovery Console and the commands that it supports.

Here is an explanation of the Recovery Console commands and their usage:

Command

Explanation                                                                                

attrib

Changes attributes on one file or directory.

ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename

More than one attribute can be set or cleared at a time. To view attributes, use the dir command.

batch

Executes commands specified in a text file.

BATCH Inputfile [Outputfile]

Inputfile Specifies the text file that contains the list of commands to be executed.

Outputfile If specified, contains the output of the specified commands. If not specified, the output is displayed on the screen.

Batch cannot be one of the commands included in the Inputfile.

cd/chdir

Displays the name of the current directory, or switches to a new directory.

CHDIR [path]

CHDIR [..]

CHDIR [drive:]

CD [path]

CD [..]

CD [drive:]

CD .. Specifies that you want to change to the parent directory.

Type CD [drive:] to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.

The chdir command treats spaces as delimiters. Use quotation marks around a directory name containing spaces. For Example:

cd "winntprofilesusernameprogramsstart menu"

Chdir operates only within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.

chkdsk

Checks a disk and displays a status report,

chkdsk [drive:] [/p] | [/r]

[drive:] Specifies the drive to check.

/p Check even if the drive is not flagged dirty, bad.

/r Locates bad sectors and recovers readable information (implies /p).

Chkdsk may be used without any parameters, in which case the current drive is checked with no switches. You can specify the listed switches.

Chkdsk requires the Autochk.exe file. Chkdsk automatically locates Autochk.exe in the startup (boot) directory. If it cannot be found in the startup directory, chkdsk attempts to locate the Windows 2000 Setup CD. If the installation CD cannot be found, chkdsk prompts for the location of Autochk.exe.

cls

Clears the screen.

copy

Copies a single file to another location.

copy source [destination]

source Specifies the file to be copied.

Destination Specifies the directory and/or file namefor the new file.

The source might be removable media, any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the cmdcons directory.

The destination might be any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the cdirectory. The destination cannot be removable media. If a destination is not specified, it defaults to the current directory. Copy does not support replaceable parameters (wild cards). Copy prompts if the destination file already exists. A compressed file from the Windows 2000 Setup CD is automatically decompressed as it is copied.

del/delete

Deletes one file.

del [drive:][path]filename

delete [drive:][path]filename

[drive:][path]filenameSpecifies the file to delete.

Delete only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.

Del and delete do not support replaceable parameters (wild cards).

dir

Displays a list of files and subdirectories in a directory.

dir [drive:][path][filename]

[drive:][path][filename] Specifies drive, directory, and/or files to list.

Dir lists all files, including hidden and system files.

Files might have the following attributes:

disable

Disables a Windows system service or driver.

disable servicename

servicename The name of the service or driver to be disabled.

Disable prints the old start_type of the service before resetting it to SERVICE_DISABLED. You should make a note of the old start_type, in case you need to enable the service again.

The start_type values that the disable command displays are:

SERVICE_DISABLED

SERVICE_BOOT_START

SERVICE_SYSTEM_START

SERVICE_AUTO_START

SERVICE_DEMAND_START

diskpart

Manages the partitions on your hard disk volumes.

diskpart[/add | /delete] [device-name | drive-name | partition-name] [size]

/add Create a new partition

/delete Delete an existing partition

device-name Device name for creating a new partition (such as DeviceHardDisk0)

drive-name Drive-letter based name for deleting an existing partition (such as D:)

partition-name Partition-based name for deleting an existing partition and can be used in place of the drive-name argument (such as DeviceHardDisk0Partition1)

size Size of the new partition, in megabytes

If no arguments are used, a user interface for managing your partitions appears.

NOTE: This command can damage your partition table if the disk has been upgraded to dynamic disk. Always use Disk Management to modify the structure of dynamic disks.

enable

Enables a Windows system service or driver.

enable servicename [start_type]

servicename Name of the service or driver to be enabled.

start_type How the service or driver is scheduled to be started. Valid start-type values are:

SERVICE_BOOT_START

SERVICE_SYSTEM_START

SERVICE_AUTO_START

SERVICE_DEMAND_START

Enable prints the old start_type of the service before resetting it to the new value. Note the old value, in case it is necessary to restore the start_type of the service. If you do not specify a new start_type, enable prints the old start_type.

exit

Quits the Recovery Console and restarts your computer.

expand

Expands a compressed file.

EXPAND source [/F:filespec] [destination] [/Y]

EXPAND source [/F:filespec] /D

source Specifies the file to be expanded. May not include wildcard (* and ?) characters.

Destination Specifies the directory for the new file. The default is the current directory.

/y Do not prompt before overwriting an existing file.

/f:filespec If the source contains more than one file, this parameter is required to identify the

/d Do not expand; only display a directory of the files which are contained in the source.

The destination might be any directory within the system directories of the current Windows installation, the root of any drive, the local installation sources, or the Cmdcons directory. The destination cannot be removable media. The destination file cannot be read-only. Use the attrib command to remove the read-only attribute. Expand prompts if the destination file already exists unless /Y is used.

fixboot

Writes a new boot sector onto the system partition.

fixboot [drive:]

drive:Specifies the drive to which a boot sector will be written, overriding the default choice of the system boot partition.

fixmbr

Repairs the master boot code of the boot partition.

fixmbr [device-name]

device-name Optional name that specifies the device that needs a new MBR. If this is left blank then the boot device is used.

If fixmbr detects an invalid or nonstandard partition table signature, it prompts you before rewriting the MBR.

NOTE: This command can damage your partition table if a virus is present or a hardware problem exists and causes partitions to become inaccessible. It is recommended that you run antivirus software before using this command.

Windows 2000 includes the antivirus software AvBoot. For more information about AvBoot, see "Troubleshooting Strategies" in this book.

format

Formats a disk for use with Windows 2000.

format [drive:] [/q] [/fs:file-system]

[drive:] Specifies the drive to format.

/q Performs a quick format.

/fs:file-system Specifies the file system to use (FAT, FAT32, or NTFS)

help

Displays information about commands supported by the Recovery Console.

help [command]

command Any Recovery Console command.

If command is not specified, all of the commands supported by the Recovery Console are listed. The command parameter is used to see the help for a specific command.

listsvc

Lists all available services and drivers on the computer.

logon

Lists the detected installations of Windows 2000, and requests the local administrator password for those installations.

map

Lists the drive letter to physical device mappings that are currently active.

map [arc]

arc Tells MAP to use ARC paths instead of Windows 2000 device paths.

md/mkdir

Creates a directory.

md [drive:]path

mkdir [drive:]path

Mkdir only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.

more/type

Displays a text file to the screen.

more [filename]

type [filename]

More or type displays a text file.

rd/rmdir

Removes (deletes) a directory.

rd [drive:]path

rmdir [drive:]path

Rmdir only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.

ren/rename

Renames a single file.

ren [drive:][path]filename1 filename2

rename [drive:][path]filename1 filename2

You cannot specify a new drive or path for your destination file.

Rename only operates within the system directories of the current Windows installation, removable media, the root directory of any hard disk partition, or the local installation sources.

set

Displays and sets Recovery Console environment variables. See tip 2615.

systemroot

Sets the current directory to %SystemRoot%.



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like