Recovery Console Commands

 
bullet Attrib: Changes the attributes of a file or directory.
bullet Batch: Executes the commands specified in the text file.
bullet Bootcfg: Boot file (boot.ini) configuration and recovery.
bullet ChDir (Cd): Displays the name of the current directory or changes the current directory.
bullet Chkdsk: Checks a disk and displays a status report.
bullet Cls: Clears the screen.
bullet Copy: Copies a single file to another location.
bullet Delete (Del): Deletes one or more files.
bullet Dir: Displays a list of files and subdirectories in a directory.
bullet Disable : Disables a system service or a device driver.
bullet Diskpart: Manages partitions on your hard drives.
bullet Enable: Starts or enables a system service or a device driver.
bullet Exit: Exits the Recovery Console and restarts your computer.
bullet Expand: Extracts a file from a compressed file.
bullet Fixboot: Writes a new partition boot sector onto the specified partition.
bullet Fixmbr: Repairs the master boot record of the specified disk.
bullet Format: Formats a disk.
bullet Help: Displays a list of the commands you can use in the Recovery Console.
bullet Listsvc: Lists the services and drivers available on the computer.
bullet Logon: Logs on to a Windows installation.
bullet Map: Displays the drive letter mappings.
bullet Mkdir (Md): Creates a directory.
bullet More: Displays a text file.
bullet Net Use: Connects a network share to a drive letter.
bullet Rename (Ren): Renames a single file.
bullet Rmdir (Rd): Deletes a directory.
bullet Set: Displays and sets environment variables.
bullet Systemroot: Sets the current directory to the systemroot directory of the system you are currently logged on to.
bullet Type: Displays a text file.

 

Attrib

Changes file attributes for a single file or directory. This command sets or removes the read-only, system, hidden, and compressed attributes assigned to files or directories.

The attrib command with the parameters listed below is only available when you are using the Recovery Console. The attrib command with different parameters is available from the command prompt.

attrib [+r|-r] [+s|-s] [+h|-h] [+c|-c] [[drive:][path] filename]

Parameters

+r

Sets the read-only file attribute.

-r

Clears the read-only file attribute.

+s

Sets the system file attribute.

-s

Clears the system file attribute.

+h

Sets the hidden file attribute.

-h

Clears the hidden file attribute.

+c

Sets the compressed file attribute.

-c

Clears the compressed file attribute.

[[drive:][path] filename]

Specifies the location and name of the directory or file you want to process. You can change attributes for only one file or directory at a time.

Note

  • You can change multiple attributes for a particular file or directory with a single command.

Related Topics

Batch

Executes the commands specified in a text file. The batch command is only available when you are using the Recovery Console, which can be started from the Setup CD.

batch input_file [output_file]

Parameters

input_file

Specifies the text file that contains the list of commands to be executed. Input_file can consist of a drive letter and a colon, a directory name, a file name, or a combination.

output_file

If specified, stores the output of the commands in the named file. If not specified, the output is displayed on the screen.

Example

The following example executes the batch file C:\Jobs\Find.txt and stores the output in the file C:\Jobs\Results.txt:

batch c:\jobs\find.txt c:\jobs\results.txt

  Note

  • A batch file cannot contain a nested batch command.

 

Bootcfg

Use the bootcfg command for boot configuration and recovery (boot.ini for most computers).

The bootcfg command with the parameters listed below is only available when you are using the Recovery Console. The bootcfg command with different parameters is available from the command prompt.

Usage:

bootcfg /default

Set the default boot entry.

bootcfg /add

Add a Windows installation to the boot list.

bootcfg /rebuild

Iterate through all Windows installations and allow the user to choose which to add.

Note

  • You should first make a backup copy of your boot.ini file by using bootcfg /copy before using bootcfg /rebuild.

bootcfg /scan

Scan all disks for Windows installations and display the results.

Note

  • These results are stored statically for this session. If the disk configuration changes during this session, in order to get an updated scan, you must first reboot the computer and then rescan the disks.

bootcfg /list

List the entries already in the boot list.

bootcfg /disableredirect

Disable redirection in the boot loader.

bootcfg /redirect [PortBaudRrate] | [useBiosSettings]

Enable redirection in the boot loader with the specified configuration.

Example:

bootcfg /redirect com1 115200

bootcfg /redirect useBiosSettings

 

Chdir (Cd)

Displays the name of the current directory or changes the current folder.

The chdir or cd command with the parameters listed below is only available when you are using the Recovery Console. The chdir command with different parameters is available from the command prompt.

chdir [drive:][path] [..]

-or-

cd [drive:][path] [..]

Parameters

none

Used without parameters, chdir displays the names of the current drive and folder. Used with only a drive letter (for example, cd C:), chdir displays the current directory on the specified drive.

[drive:][path]

Specifies the drive (if other than the current drive) and directory to which you want to change.

[..]

Specifies that you want to change to the parent folder. Use a space between chdir and the two periods.

Notes
 

  • Chdir treats spaces as delimiters. Use quotation marks around a directory name containing spaces. For example:

    cd "driver cache"

  • Chdir 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.

Chkdsk

Creates and displays a status report for the disk. The chkdsk command also lists and corrects errors on the disk.

The chkdsk command with the parameters listed below is only available when you are using the Recovery Console. The chkdsk command with different parameters is available from the command prompt.

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

Parameters

none

Used without parameters, chkdsk displays the status of the disk in the current drive.

drive:

Specifies the drive that you want chkdsk to check.

/p

Performs an exhaustive check even if the drive is not marked for chkdsk to run. This parameter does not make any changes to the drive.

/r

Locates bad sectors and recovers readable information. Implies /p.

Note

  • The chkdsk command requires the file Autochk.exe. If it cannot find it in the startup directory (\%systemroot%\System32, by default), it will attempt to locate it on the Windows Installation CD. If you have a multiboot computer, be sure you are issuing this command from the drive containing Windows.

 

Cls

Clears the screen.

The cleared screen shows only the command prompt and insertion point.

cls

Parameters

none

 

Copy

Copies a single file to another location. The copy command with the parameters listed below is only available when you are using the Recovery Console. The copy command with different parameters is available from the command prompt.

copy source [destination]

Parameters

source

Specifies the location and name of the file to be copied. Source can consist of a drive letter and colon, a directory name, a file name, or a combination.

destination

Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a folder name, a file name, or a combination.

  • The source may 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 may be any of the same locations as the source except removable media. If a destination is not specified, it defaults to the current directory.
  • A compressed file from the Windows Installation CD is decompressed as it is copied.
  • Copy does not support wildcard characters.

 

Delete (Del)

Deletes a single file. The delete or del command with the parameters listed below is only available when you are using the Recovery Console. The delete or del command with different parameters is available from the command prompt.

delete [drive:][path] filename

-or-

del [drive:][path] filename

Parameters

[drive:][path] filename

Specifies the location and name of the file you want to delete.

Note

  • 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.

 

Dir

Displays a list of the files and subdirectories in a directory. The dir command with the parameters listed below is only available when you are using the Recovery Console. The dir command with different parameters is available from the command prompt.

dir [drive:][path][filename]

Parameters

[drive:][path]

Specifies the drive and directory for which you want to see a listing.

[filename]

Specifies a particular file or group of files for which you want to see a listing. Multiple file names can be used. File names can be separated by spaces, commas, or semicolons. You can use wildcard characters (? and *) in the filename parameter to display a group of files.

Dir also lists the disk's volume label and serial number, and the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk. For each file and subdirectory, dir lists the file name extension, the file size in bytes, the date and time the file was last modified, and the following file attributes, if applicable:

Abbreviation Attribute
d Directory
h Hidden file
s System file
e Encrypted
r Read-only
a File ready for archiving
c Compressed
p Reparse point


 

Note

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

 

Disable

Disables a Windows XP, Windows 2000 or Windows NT 4.0 system service or a device driver. The disable command is only available when you are using the Recovery Console.

disable {[service_name] | [device_driver_name]}

Parameters

service_name

The name of the system service you want to disable.

device_driver_name

The name of the device driver you want to disable.

Example

The following example disables the Eventlog service:

disable eventlog

Notes

  • The disable command sets the startup type to SERVICE_DISABLED for the service or driver you specify.
  • When you use the disable command to disable a system service or a device driver, the name of the previous startup type for the system service or device driver will display on the screen. You should write this name down in case you need to restore the startup type to its previous setting using the enable command.
  • There are five startup types. The first three, SERVICE_AUTO_START, SERVICE_DISABLED, and SERVICE_DEMAND_START, correspond to the standard startup types, Automatic, Disabled, and Manual, which you typically configure using Services in the Computer Management administrative tool. The last two, SERVICE_BOOT_START and SERVICE_SYSTEM_START, are commonly used to configure the way device drivers load; for example, when the computer is started or when Windows starts.

 

Diskpart

Creates and deletes partitions on a hard drive. The diskpart command is only available when you are using the Recovery Console.

diskpart [/add | /delete] [device_name | drive_name | partition_name] [size]

Parameters

none

Used without parameters, the diskpart command starts the Windows character-mode version of diskpart.

/add

Creates a new partition.

/delete

Deletes an existing partition.

device_name

The device on which you want to create or delete a partition. The name can be obtained from the output of the map command. An example of a device name is:

\Device\HardDisk0

drive_name

The partition you want to delete, by drive letter. Used only with /delete. An example of a drive name is:

D:

partition_name

The partition you want to delete, by partition name. Can be used in place of the drive_name. Used only with /delete. An example of a partition name is:

\Device\HardDisk0\Partition1

size

The size, in megabytes (MB), of the partition you want to create. Used only with /add.

Examples

The following examples delete a partition:

diskpart /delete \Device\HardDisk0\Partition3

diskpart /delete F:

The following example adds a 20 MB partition to your hard drive:

diskpart /add \Device\HardDisk0 20

 

Enable

Enables a Windows XP, Windows 2000 or Windows NT 4.0 system service or a device driver. The enable command is only available when you are using the Recovery Console.

enable {service_name | device_driver_name} [startup_type]

Parameters

service_name

The name of the system service you want to enable.

device_driver_name

The name of the device driver you want to enable.

startup_type

The startup type that you want to designate for the service or device driver. Valid startup types are:

  • SERVICE_BOOT_START
  • SERVICE_SYSTEM_START
  • SERVICE_AUTO_START
  • SERVICE_DEMAND_START

Example

The following example sets the startup type for the Eventlog service to Automatic or SERVICE_AUTO_START:

enable eventlog service_auto_start

Notes

  • If you do not designate a startup type, the enable command lists the current startup type for the service or device driver you specified in service_name.
  • When you use the enable command to change a startup type, the previous startup type's name will display on the screen. You should write this name down in case you need to restore the startup type to the previous setting.

Exit

Closes the Recovery Console and restarts your computer. The exit command is available when you are using the Recovery Console.

exit

Parameters

none

Expand

Extracts a file from a compressed file. Use this command to extract a driver file from a cabinet (.cab) or compressed file.

The expand command with the parameters listed below is only available when you are using the Recovery Console. The expand command with different parameters is available from the command prompt.

expand source [/F:filespec}] [destination] [/d] [/y]

Parameters

source

Specifies the file to expand. Use this if the source file contains a single file. Source can consist of a drive letter and a colon, a directory name, a file name, or a combination. You cannot use wildcard characters.

/f:filespec

If the source contains more than one file, this specifies the name of the file you want to extract. You can use wildcards for the files you want to extract.

destination

Specifies both the destination directory and file name for the extracted file, or each individually.

/d

Lists the files contained in the cabinet file without expanding it or extracting from it.

/y

Suppresses the overwrite prompt when expanding or extracting files.

Examples

The following example extracts the file Msgame.sys from the Drivers cabinet file on a Setup CD and copies it to C:\Windows\System\Drivers:

expand d:\i386\driver.cab /f:msgame.sys c:\Windows\system\drivers

The following example expands the compressed file Access.cp_:

expand d:\i386\acces.cp_ c:\Windows\system32\access.cpl

The following example lists all the files in the Drivers cabinet file on the Setup CD:

expand /d d:\i386\driver.cab

Important

  • The Driver cabinet file, which contains most of the drivers provided by Windows, includes thousands of files. Expanding all of the files from this cabinet file onto your hard disk will take time and a lot of disk space. It is recommended that you extract only the file you need from this file.

Notes

  • If the destination is not specified, the file is copied to the current directory.
  • You cannot specify removable media such as a floppy disk drive or a CD-ROM as the destination.

Fixboot

Writes a new partition boot sector to the system partition. The fixboot command is only available when you are using the Recovery Console.

fixboot [drive]

Parameter

drive

The drive to which a boot sector will be written. This replaces the default drive, which is the system partition you are logged on to. An example of a drive is:

D:

Example

The following example writes a new partition boot sector to the system partition in drive D:

fixboot d:

Note

  • Using the fixboot command without any parameters will write a new partition boot sector to the system partition you are logged on to.

Fixmbr

Repairs the master boot record of the boot disk. The fixmbr command is only available when you are using the Recovery Console.

fixmbr [device_name]

Parameter

device_name

The device (drive) on which you want to write a new master boot record. The name can be obtained from the output of the map command. An example of a device name is:

\Device\HardDisk0.

Example

The following example writes a new master boot record to the device specified:

fixmbr \Device\HardDisk0

Notes

  • If you do not specify a device_name, a new master boot record will be written to the boot device, which is the drive on which your primary system is loaded.
  • If an invalid or nonstandard partition table signature is detected, you will be prompted whether you want to continue. If you are not having problems accessing your drives, you should not continue. Writing a new master boot record to your system partition could damage your partition tables and cause your partitions to become inaccessible.

Format

Formats the specified drive to the specified file system. The format command with the parameters listed below is only available when you are using the Recovery Console. The format command with different parameters is available from the command prompt.

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

Parameters

drive:

Specifies the drive you want to format. You cannot format a floppy disk from the Recovery Console.

/q

Performs a quick format of the drive. The drive is not scanned for bad areas, so you should use this parameter only on drives that you have previously formatted.

/fs:file-system

Specifies the file system to use: FAT, FAT32, or NTFS. If you don't specify a file system, the existing file system format is used.

Help

Provides online information about the Recovery Console commands.

help [commandname]

Parameter

none

Lists the commands that are available in the Recovery Console.

commandname

Provides information about the command, including the parameters you can use with the command.

Note

  • There are two ways to get online Help for a command. You can specify the name of the command after the help command, or you can type the name of the command and the /? switch at the command prompt. For example, you can type either of the following commands to get information about the extract command:

    help extract
    extract /?

Listsvc

Lists the services and drivers available on the computer. The listsvc command is only available when you are using the Recovery Console.

listsvc

Parameters

none

Logon

Logs you on to an installation of Windows. The logon command is only available when you are using the Recovery Console.

logon

Parameters

none

Notes

  • The logon command will list all detected installations of Windows and request the local administrator password for the installation to log you on.
  • After 3 unsuccessful logon attempts, the Recovery Console will exit and the computer will be rebooted.

Map

Displays a mapping of drive letters to physical device names. This information is useful when you run the fixboot and fixmbr commands. The map command is only available when you are using the Recovery Console.

Map [arc]

Parameter

arc

Instructs the map command to display Advanced RISC Computing (ARC) device names instead of device names. An example of an ARC device name is:

multi(0)disk(0)rdisk(0)partition(1)

The equivalent device name is:

\Device\HardDisk0\Partition1

Example

The following example maps the physical device names to the drive letters using ARC device names:

map arc

Notes

  • If you do not use the arc parameter, the map command displays device names.
  • The map command also displays the type of file system and the size of each disk in megabytes (MB).

Mkdir (Md)

Creates a directory or subdirectory. The mkdir command with the parameters listed below is only available when you are using the Recovery Console. The mkdir command with different parameters is available from the command prompt.

mkdir [drive:]path

-or-

md [drive:]path

Parameters

drive:

Specifies the drive on which you want to create the new directory.

path

Specifies the name and location of the new directory. You cannot use wildcard characters.

Note

  • 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

Displays the contents of a text file. Use the more or type command to view a text file without modifying it. The more command with the parameters listed below is only available when you are using the Recovery Console. The more command with different parameters is available from the command prompt.

more [drive:][path] filename

-or-

type [drive:][path] filename

Parameter

[drive:][path] filename

Specifies the location and name of the file that you want to view.

If you are using an NTFS drive, and the file name contains spaces, you must enclose the file name within quotation marks (").

Net use

Connects a network share to a drive letter. The net use command with the parameters listed below is only available when you are using the Recovery Console. The net use command with different parameters is available from the command prompt.

Syntax

net use [\\ComputerName\ShareName [/user:[DomainName\]UserName] password] | [drive letter:] [/d]

Parameters

\\ComputerName\ShareName

Specifies the name of the server and the shared resource. If ComputerName contains blank characters, enclose the entire computer name from the double backslash (\\) to the end of the computer name in quotation marks. The computer name can be from 1 to 15 characters long.

/user:

Specifies the user name with which the connection is made.

DomainName

Domain-name to use when validating the credentials for the User.

UserName

Specifies the user name with which to log on.

Password

Specifies the password needed to access the shared resource. Leave blank to produce a prompt for the password. The password is not displayed when you type it at the password prompt.

/d

Indicates that this connection is to be disconnected.

Rename (Ren)

Changes the name of a single file. The rename command with the parameters listed below is only available when you are using the Recovery Console. The rename command with different parameters is available from the command prompt.

rename [drive:][path] filename1 filename2

-or-

ren [drive:][path] filename1 filename2

Parameters

[drive:][path] filename1

Specifies the location and name of the file you want to rename. You cannot use wildcard characters.

filename2

Specifies the new name for the file. You cannot specify a new drive or path when renaming files.

Rmdir (Rd)

Removes (deletes) a directory. The rmdir command with the parameters listed below is only available when you are using the Recovery Console. The rmdir command with different parameters is available from the command prompt.

rmdir [drive:]path

-or-

rd [drive:]path

Parameters

[drive:]path

Specifies the location and name of the directory you want to delete. You cannot use wildcard characters.

Notes

  • The directory must be empty or the command will fail.
  • 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.

Set

Displays and sets Recovery Console environment variables. The set command is an optional command that must be used with Security Templates.

The set command with the parameters listed below is only available when you are using the Recovery Console. The set command with different parameters is available from the command prompt.

set [variable=[string]]

Parameters

variable

Specifies the variable you want to set or modify.

The Recovery Console supports the following environment variables:

Variable Description
AllowWildCards Enables wildcard support for some commands (such as the del command).
AllowAllPaths Allows all files and directories on the system to be accessed.
AllowRemovableMedia Allows files to be copied to removable media, such as a floppy disk.
NoCopyPrompt Does not display a prompt when overwriting an existing file.


 

string

Specifies the string you want to associate with the specified variable.

Examples

The following example enables you to use wildcards with some Recovery Console commands:

set allowwildcards=true

The following example turns off the prompt when you are overwriting files:

set nocopyprompt=true

Notes

  • Used without parameters, set displays the current environment settings.
  • The set command is disabled by default. To enable the set command, use the Security templates. The Enables the Set command for the Recovery Console attribute is located in the console tree under Local Computer Policy/Computer Configuration/Windows Settings/Security Settings/Local Policies/Security Options.
  • All environmental variables are set to FALSE by default.

Systemroot

Sets the current directory to the systemroot folder of the Windows installation you are logged on to. The systemroot command is only available when you are using the Recovery Console.

systemroot

Parameters

none

Type

Displays the contents of a text file. Use the type or more command to view a text file without modifying it. The type command with the parameters listed below is only available when you are using the Recovery Console. The type command with different parameters is available from the command prompt.

type [drive:][path] filename

-or-

more [drive:][path] filename

Parameter

[drive:][path] filename

Specifies the location and name of the file that you want to view.

If you are using an NTFS drive, and the file name contains spaces, you must enclose the file name within quotation marks.

The above content is from the Microsoft Windows XP Help and Support Console.