Bagikan melalui


Recovery Console Tools and Settings

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Recovery Console Tools and Settings

In this section

  • Recovery Console Tools

  • Recovery Console Group Policy Settings

  • Related Information

This section lists the tools and the syntax that you can use with Recovery Console. Recovery Console is a character-mode environment that you can run from the Windows Server 2003 operating system CD or install on x86-based computers as a startup option. You should use Recovery Console only when other startup options have failed to start your system. You will need the password for the built-in Administrator account to use Recovery Console

You can use the Recovery Console Group Policy settings to enable the set command to customize Recovery Console or to enable logon to the console without the administrator password.

Recovery Console Tools

The following tools are associated with Recovery Console. When using Recovery Console, you can view and reuse previous commands by pressing the UP ARROW and DOWN ARROW keys, which move you forward or backward through your command history.

For the list of Recovery Console commands that follow, brackets ([]) enclose optional parameters and a pipe (|) separates mutually-exclusive choices. Recovery Console commands and parameters are not case sensitive.

Attrib

Use the attrib command to change the file attributes for a single file or folder. Use the following syntax:

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

+

Sets an attribute.

-

Clears an attribute.

c

Sets or clears a compressed file attribute.

h

Sets or clears a hidden file attribute.

r

Sets or clears a read-only file attribute.

s

Sets or clears a system file attribute.

drive:

Specifies the drive letter to use.

path:

Specifies the directory path to use.

You should also follow these guidelines when you use the attrib command:

  • You must set or clear at least one attribute.

  • You can change attributes for only one file or directory at a time.

  • You can view attributes by using the dir command.

  • Do not separate attribute parameters with spaces.

  • You can set multiple attributes simultaneously.

    • To change multiple attributes in the same way, use either the set or clear parameter (+ or -). Include all the attribute options to be changed, and do not separate them with spaces. For example, to set the compressed, hidden, and read-only attributes for a single file, type the following:

      attrib +chr filename
      
    • To change multiple attributes in different ways, use the set parameter (+) and include all the attribute letters to be set, followed without a space by the clear parameter (-) and all the attribute letters to be cleared. For example, to set the compressed and hidden file attributes and to clear the read-only file attribute, type:

      attrib +ch-r filename
      

Batch

Use the batch command to run the commands specified in a text file. Use the following syntax:

batchinputfile [outputfile]
Parameter Description

inputfile

Specifies the text file (by using [drive:][path][filename] format) that contains the list of commands you want to carry out.

outputfile

If specified, stores the output of the batch command in the specified file. If you do not specify a value for outputfile, the batch command displays its output on the screen. Specify outputfile by using [drive:][path][filename] format

The batch command cannot call itself recursively. Do not include the batch command in the file specified by the inputfile parameter.

Bootcfg

For x86-based systems, use the bootcfg command to scan your hard disks and use the information to modify the contents of the Boot.ini file or rebuild a new copy. Always back up the Boot.ini file before modifying it. Use the following syntax:

bootcfg [/add] [/default]| [/list] [/rebuild] [/scan] 
Parameter Description

/add

Adds a Windows installation to the operating system boot menu list.

/default

Sets the default boot menu.

/disableems

Disables redirection in the Windows loader

/ems

Enables redirection in the Windows loader for a specific configuration.

/list

Lists the entries already in the boot menu list.

/rebuild

Scans hard disks for Windows installations and selects which to add.

/scan

Scans all disks for Windows installations and displays the results.

Note

  • The Recovery Console bootcfg command is not the same as the Windows Server 2003 Bootcfg.exe command-line tool. Bootcfg.exe resides in the systemroot\System32 folder and is a stand-alone command-line tool that you cannot use in Recovery Console

Cd or Chdir

Use the cd or chdir command to display the name of the current volume or directory, or to change to the folder specified. The chdir command 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. Use the following syntax:

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

–or–

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

If you want to display the current volume and folder, use the cd or chdir command without parameters.

Parameter Description

path

Specifies the directory that you want to change to.

..

Displays the parent folder.

drive:

Specifies the drive that you want to change to.

These commands treat spaces as delimiters, which require that a space is inserted before all arguments, including double periods. Use quotation marks to enclose a path or file name that contains a space.

Chkdsk

Use the chkdsk command to check a volume, and if needed, to repair the volume. Also, use chkdsk to recover and move readable information before marking bad sectors as unusable. Use the following syntax:

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

You can use the chkdsk command without parameters. When you do not specify a volume, chkdsk runs on the current volume.

Parameter Description

drive:

Specifies the volume that you want chkdsk to check.

/p

Performs an exhaustive volume check. This parameter does not make any changes to the volume.

/r

Locates bad sectors and recovers readable information before marking them as unusable. Implies /p.

Chkdsk requires the file Autochk.exe. If chkdsk cannot find Autochk.exe in the systemroot\System32 directory, it attempts to locate Autochk.exe on the Windows Server 2003 installation CD.

Cls

Use the cls command to clear the screen and redisplay the command prompt. Use the following syntax:

cls

Copy

Use the copy command to copy a single file to a specified location. Use the following syntax:

copysourcedestination
Parameter Description

source

Specifies the file (by using [drive:][path][filename] format) that you want copied.

destination

Specifies the destination (to by using [drive:][path][filename] format) that you want the file source file copied format.

You should also follow these guidelines when you use the copy command:

  • You cannot use wildcard characters (for example: * and ?) with the copy command.

  • If you do not specify a destination directory, the copy command uses the current folder by default.

  • If you do not specify a destination file name, the copy command uses the existing file name by default.

  • If the destination file name already exists, you are warned before overwriting it.

  • Compressed files from the Windows Server 2003 operating system CD are automatically expanded as they are copied.

  • The source can 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 can be any of the same locations as the source except removable media. If a destination is not specified, it defaults to the current directory.

Del or Delete

Use the del or delete command to delete a file or folder. Use the following syntax:

del [drive:][path]filename

–or–

delete [drive:][path]filename
Parameter Description

drive:

Specifies the volume of the file that you want to delete.

path

Specifies the directory of the file that you want to delete.

filename

Specifies the file that you want to delete.

You cannot use wildcard characters with this command. The delete command 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

Use the dir command to display a list of the files and folders in a directory and to specify 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:

Use the following syntax:

dir [drive:][path][filename]
Parameter Description

drive:

Specifies the volume of the directory for which you want a listing.

path

Specifies the directory for which you want a listing.

filename

Specifies the file for which you want a listing.

In Recovery Console, the dir command functions differently that the command line because it lists all folders and files, including those with hidden and system attributes set. For each file and subdirectory, the dir command lists its attributes (if they apply) by using the following abbreviations.

a

Archive

c

Compressed

d

Directory

e

Encrypted

h

Hidden

p

Reparse point

r

Read-only

s

System file

Disable

Use the disable command to disable a service or driver. Use the following syntax:

disableservicename
Parameter Description

servicename

Specifies the service or driver that you want to disable.

Use a related command, listsvc, to view a list of service and driver names for your system. The disable command displays the previous start type of the service before changing it to SERVICE_DISABLED. Record this value so that you can restore the original state of the service after troubleshooting a problem.

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 the Services snap-in 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 Windows starts.

Diskpart

Use the diskpart command to manage the partitions on your hard disk. For example, you can use diskpart to create or delete disk partitions. Use the following syntax:

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

/add

Creates a new disk partition.

/delete

Deletes an existing partition.

device-name

Specifies the name of the device for which you want to create or delete a partition, for example, \Device\HardDisk0. To obtain the name of a device, view the output of the map command.

drive-name

Specifies the drive letter of the partition that you want to delete, for example, D:. Use only with /delete.

partition-name

Specifies the partition that you want to delete and can be used in place of the drive-name parameter. For example,\Device\HardDisk0. Use only with /delete.

size

Specifies the size, in megabytes, of the partition you want to create. Use only with /add.

If you do not use a parameter, a user interface for managing your partitions appears.

Note

  • This command can damage your partition table if the disk has been upgraded to a dynamic disk. Do not modify the structure of dynamic disks unless you are using the Disk Management snap-in.

Enable

Use the enable command to enable or change the startup type of a service or driver. Use the following syntax:

enableservicename [start_type]
Parameter Description

servicename

Specifies the service or driver that you want to enable.

start_type

Specifies the startup type for a service or driver. Valid values are:

  • SERVICE_BOOT_START

  • SERVICE_SYSTEM_START

  • SERVICE_AUTO_START

  • SERVICE_DEMAND_START

Use the related command, listsvc, to view a list of service and driver names for your system. The enable command displays the previous start type of the service before changing it. Record this value so that you can restore the original state of the service after troubleshooting a problem.

If you do not specify a new start type, the enable command displays the previous start type.

Exit

Use the exit command to close Recovery Console and restart your computer. Use the following syntax:

exit

Expand

Use the expand command to expand a compressed file that is stored on the Windows Server 2003 operating system CD or from within a cabinet (.cab) file, and copy it to a specified destination. If the destination is not specified, the file is copied to the current directory. Use the following syntax:

expandsource [/f:filespec] [target] [/y]
expandsource [/f:filespec] /d
Parameter Description

source

Specifies the file that you want to expand (by using [drive:][path][filename] format). You cannot use wildcard characters (* and ?).

target

Specifies the destination folder and/or file name for the new file by using [drive:][path][filename] format.

/f:filespec

Specifies the specific file(s) that you want to expand if the source contains more than one file. Wildcards are optional.

/y

Specifies that the confirmation prompt (that appears when attempting to overwrite an existing file) is not required.

/d

Specifies that files display, but does not expand the files in the .cab file.

You cannot specify removable media such as a floppy disk drive or a CD-ROM as the destination.

Fixboot

Use the fixboot command to rewrite the boot sector code to a hard disk. This is useful for repairing a corrupted boot sector on x86-based systems. If you need to replace the boot sector of a volume that is not the system volume, then you must specify the appropriate drive letter. Use the following syntax:

fixboot [drive:]
Parameter Description

drive:

Specifies the volume drive letter on which to rewrite a new boot sector.

If you do not specify a drive, the default is the system boot volume.

Fixmbr

Use the fixmbr command to rewrite the master boot code of the master boot record (MBR) of the startup hard disk. This command is useful for repairing corrupted MBRs. Use the following syntax:

fixboot [device-name]
Parameter Description

device-name

Specifies the name of the device that needs a new MBR, for example, \Device\HardDisk1.

If you do not specify a device, the default is disk 0. If disk 0 is not the device that needs repairing, you can obtain the device name of other disks by using the map command.

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

Use this command with care because it can damage your partition table if any of the following applies:

  • A virus is present and a non-Microsoft operating system is installed on the same computer.

  • A nonstandard MBR is installed by a non-Microsoft disk utility.

  • A hardware problem exists.

Always run antivirus software before using this command.

When you run the fixmbr command, it only overwrites the master boot code and leaves the existing partition table intact. If corruption in the MBR affects the partition table, running the fixmbr command might not resolve the problem.

Format

Use the format command to format the specified volume to the specified file system. Use the following syntax:

format [drive:] [/q] [/fs:file_system]
Parameter Description

drive:

Specifies the drive letter for the volume you want to format.

/q

Specifies a quick format (clears only the table of contents).

/fs:file-system

Specifies the file system you want to use. Valid values for file-system include FAT, FAT32, and NTFS.

Consider the following guidelines before using the format command:

  • If a file system is not specified, the format command defaults to the NTFS file system.

  • If you choosing FAT for the file system, this command formats a volume as FAT16. FAT16 volumes cannot be larger than 4 GB. Limit FAT16 partitions to2 GB to increase storage efficiency and to maintain compatibility with MS-DOS, Windows 95, Windows 98, and Windows Millennium Edition.

  • Windows Server 2003 can format FAT32 volumes up to 32 GB in size. For larger volumes, use NTFS.

Help

Use the help command to view Help information for Recovery Console commands. Use the following syntax:

help [command]
Parameter Description

Command

Specifies the drive letter for the volume you want to format.

Use the command parameter to specify a name of any Recovery Console command.

If you do not specify a parameter, Help lists information about all the supported commands.

Listsvc

Use the listsvc command to view details about the services and drivers on your system, including service start types. Use the following syntax:

listsvc

Use the listsvc command together with the disable and enable commands. The information displayed is extracted from the registry file System that is located in the *systemroot\*System32\Config folder. If the file System is damaged or missing, the information displayed might be inaccurate.

Logon

Use the logon command to detect and logon to Windows installations. Use the following syntax:

logon

You must correctly enter the local administrator password within three attempts or the computer will restart.

Map

Use the map command to list all drive letters, file system types, volume sizes, and mappings to physical devices that are currently active. Use the following syntax:

map [arc]
Parameter Description

Arc

Use the arc parameter to force the use of the Advanced RISC Computing (ARC) specification format to describe paths instead of using device paths. You can use this information to create or repair the Boot.ini file.

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

The map command might not work correctly with systems that are using dynamic disk features.

Md or Mkdir

Use the md or mkdir command to create a new directory or subdirectory. Use the following syntax:

md [drive:]pathmkdir [drive:]path
Parameter Description

drive:

Specifies the volume on which to create a folder.

path

Specifies the name of the folder to create.

The md or mkdir command has the following limitations:

  • You cannot use wildcard characters with this command.

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

  • This command might not display all the volumes on a disk or the correct volume sizes on dynamic disks.

More or Type

Use the more or type command to display the contents of a text file. Use the following syntax:

more [path\]filenametype [path\]filename
Parameter Description

filename

Specifies the file name to view.

path

Specifies the folder where the file is located.

If a text file is too large to fit on one screen, use the following page viewing options:

  • ENTER Scroll down one line at a time.

  • SPACEBAR Scroll down one page at a time.

  • ESC to quit viewing the text file.

Rd or Rmdir

Use the rd or rmdir command to delete a directory or subdirectory. Use the following syntax:

rd [drive:]pathrmdir [drive:]path
Parameter Description

drive:

Specifies the volume on which to delete a folder.

Path

Specifies the name of the folder to delete.

The rd or rmdir command has the following limitations:

  • You cannot use wildcard characters with this command.

  • The path must be empty or the command will fail.

  • The command 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 or Rename

Use the ren or rename command to rename a file or directory. Use the following syntax:

ren [drive:][path]name1 name2rename [drive:][path]name1 name2
Parameter Description

drive:

Specifies the volume drive letter on which the file to be renamed resides.

path

Specifies the path to the file or folder to be renamed.

name1

Specific the file or folder to be renamed.

name2

Specifies the new name for the file or folder.

You cannot use wildcard characters with this command.

Set

Use the set command to set Recovery Console environment variables. Recovery Console disables the set command by default. To enable the set command, you must enable the Allow floppy copy and access to all drives and all folders Group Policy setting. For more information about the Group Policy settings for Recovery console, see “Recovery Console Group Policy Settings” later in this topic.

Use the following syntax:

set [variable = [TRUE|FALSE]]
Environment Variable Description

AllowWildCards

Set to TRUE to enable wildcard character (* and ?) support for some commands, such as DEL, that do not otherwise support them.

AllowAllPaths

Set to TRUE to allow access to all files and folders on the computer.

AllowRemovableMedia

Set to TRUE to allow files to be copied to removable media, such as floppy disks.

NoCopyPrompt

Set to TRUE to suppress the confirmation prompt that appears when overwriting a file.

To display the list of current environment variables, use the set command without specifying a parameter. All Recovery Console environmental variables are set to FALSE by default.

Systemroot

Use the systemroot command to set the current directory to the systemroot directory of the Windows Server 2003 installation with which you are currently working. Use the following syntax:

systemroot

Recovery Console Group Policy Settings

The following table lists and describes the Group Policy settings that are associated with Recovery Console.

Group Policy Settings Associated with Recovery Console

Group Policy Setting Description

Allow floppy copy and access to all drives and all folders

Must be enabled in order to use the set command to customize Recovery Console

Recovery Console: Allow automatic administrative logon

Allows you to to bypass the logon process when Recovery Console starts. Activating this policy eliminates a security barrier intended to protect your computer against unauthorized users. Therefore, It is important that you enable this policy only on systems that have secure consoles, such as those in locked rooms.

The following resources contain additional information that is relevant to this section.