101
Windows 2000 Command Line Page 1 of 101 Introduction – page 3 A – page 6 Append Arp Assoc At Atmadm Attrib B – page 9 Batch commands Break Buffers C – page 9 Cacls Call Chcp Chdir (cd) Chkdsk Chkntfs Cipher Cls Cluster Cluster commands overview Cluster group Cluster node Cluster netinterface Cluster network Cluster resource Cluster resourcetype Cmd Codepage Color Command symbols and filter commands Comp Compact Conditional processing symbols Convert Copy Country D – page 26 Date Debug Debug subcommands Del (Erase) Device Devicehigh (dh) Devinfo Dir Diskcomp Diskcopy Diskperf Dos Doskey Dosonly Driveparm E – page 31 Echo Echoconfig Edit Edlin Edlin subcommands Endlocal Evntcmd Exe2bin Exit Expand F – page 33 Fastopen Fc Fcbs Files Filter commands Find Findstr Finger For Forcedos Format Ftp Ftp commands Ftype G – page 40 Goto Graftabl Graphics H – page 41 Help Hostname I – page 42 If Install Ipconfig Ipxroute Irftp L – page 44 Label Lastdrive Libpath Loadfix Loadhigh (lh) Lpq Lpr M – page 45 Mem Mkdir (md) Mode More Mountvol Move MS-DOS configuration commands MS-DOS subsystem commands

W2K Cmd Line

Embed Size (px)

Citation preview

Page 1: W2K Cmd Line

Windows 2000 Command Line

Page 1 of 101

Introduction – page 3

A – page 6

Append

Arp

Assoc

At

Atmadm

Attrib

B – page 9

Batch commands

Break

Buffers

C – page 9

Cacls

Call

Chcp

Chdir (cd)

Chkdsk

Chkntfs

Cipher

Cls

Cluster

Cluster commands overview

Cluster group

Cluster node

Cluster netinterface

Cluster network

Cluster resource

Cluster resourcetype

Cmd

Codepage

Color

Command symbols and filter commands

Comp

Compact

Conditional processing symbols

Convert

Copy

Country

D – page 26

Date

Debug

Debug subcommands

Del (Erase)

Device

Devicehigh (dh)

Devinfo

Dir

Diskcomp

Diskcopy

Diskperf

Dos

Doskey

Dosonly

Driveparm

E – page 31

Echo

Echoconfig

Edit

Edlin

Edlin subcommands

Endlocal

Evntcmd

Exe2bin

Exit

Expand

F – page 33

Fastopen

Fc

Fcbs

Files

Filter commands

Find

Findstr

Finger

For

Forcedos

Format

Ftp

Ftp commands

Ftype

G – page 40

Goto

Graftabl

Graphics

H – page 41

Help

Hostname

I – page 42

If

Install

Ipconfig

Ipxroute

Irftp

L – page 44

Label

Lastdrive

Libpath

Loadfix

Loadhigh (lh)

Lpq

Lpr

M – page 45

Mem

Mkdir (md)

Mode

More

Mountvol

Move

MS-DOS configuration commands

MS-DOS subsystem commands

Page 2: W2K Cmd Line

Windows 2000 Command Line

Page 2 of 101

N – page 48

Nbtstat

Net (command options)

Net accounts

Net computer

Net config

Net config server

Net config workstation

Net continue

Net file

Net group

Net help

Net helpmsg

Net localgroup

Net name

Net pause

Net print

Net send

Net session

Net share

Net start

Net start Alerter

Net start Client Service for NetWare

Net start ClipBook Server

Net start Computer Browser

Net start DHCP Client

Net start Directory Replicator

Net start Eventlog

Net start File Server for Macintosh

Net start FTP Publishing Service

Net start Gateway Service for NetWare

Net start Lpdsvc

Net start Messenger

Net start Microsoft DHCP Service

Net start Net Logon

Net start Network DDE

Net start NT LM Security Support Provider

Net start OLE

Net start Print Server for Macintosh

Net start Remote Access Connection Manager

Net start Remote Access ISNSAP Service

Net start Remote Procedure Call (RPC) Locator

Net start Remote Procedure Call (RPC) Service

Net start Schedule

Net start Server

Net start Simple TCP/IP Services

Net start Site Server LDAP Service

Net start SNMP

Net start Spooler

Net start TCP/IP NetBIOS Helper

Net start UPS

Net start Windows Internet Name Service

Net start Workstation

Net statistics

Net stop

Net time

Net use

Net user

Net view

Netsh

Netstat

Nlsfunc

Nslookup

Nslookup subcommands

Ntcmdprompt

O – page 64

OS/2 configuration command

P – page 64

Path

PathPing

Pause

Pax

Pentnt

Ping

Popd

Portuas

Print

Prompt

Protshell

Pushd

Q – page 69

QBasic

R – page 69

Rcp

Recover

Redirection

Rem

Rename (ren)

Replace

% (Replaceable parameter)

Rexec

Rmdir (rd)

Route

Rsh

Runas

S – page 73

Set

Setlocal

Setver

Share

Shell

Shift

Sort

Stacks

Start

Subst

Switches

T – page 76

Tcmsetup

TCP/IP Utilities

Tftp

Time

Title

Tracert

Tree

Type

V – page 78

Ver

Verify

Vol

W – page 79

Winnt

Winnt32

X – page 81

Xcopy

Appendix A – Recovery Console – page 83

Appendix B – NTDSutil (Directory Services Restore Mode) – page 94

Page 3: W2K Cmd Line

Windows 2000 Command Line

Page 3 of 101

Introduction

Using Windows 2000 Command Reference Windows 2000 provides a rich set of command line functions that extend and enhance what has been possible with previous versions of Windows 2000 and MS-DOS. You can use these commands directly from a command prompt; for example, to change folders (chdir or cd), to obtain a list of the contents of a folder (dir), or to copy files (copy and xcopy). In addition, you can combine and organize these commands into a batch file. Batch files (also called batch programs) allow you to simplify routine or repetitive tasks. A batch program is a text file that contains one or more commands and has a .bat or .cmd file name extension. When you type the file name at the command prompt, the commands in the file are executed sequentially. Putting together a batch file makes it possible to take advantage of program control commands such as if statements, goto statements, and for loops, which are standard program control constructs.

What's new or different from MS-DOS Windows 2000 retains and enhances almost all the functionality of MS-DOS. These tables explain new Windows 2000 commands not found in MS-DOS, changes to MS-DOS commands, and unavailable MS-DOS commands. Windows 2000 Commands This table explains Windows 2000 system commands not found in MS-DOS.

Command Function at Schedules commands and programs to run on a computer at a specified time and date. cacls Displays or modifies access control lists (ACLs) of files. convert Converts file systems from FAT or FAT32 to NTFS. dosonly Prevents starting applications other than MS-DOS-based applications from the Command.com prompt. echoconfig Displays messages when reading the MS-DOS subsystem Config.nt file. endlocal Ends localization of environment variables. findstr Searches for text in files using regular expressions. ntcmdprompt Runs the Windows 2000 command interpreter, Cmd.exe, rather than Command.com after running a TSR or

after starting the command prompt from within an MS-DOS application. popd Changes to the directory last set with the pushd command. pushd Saves the current directory for use by the popd command, and then changes to the specified directory. setlocal Begins localization of environmental variables. start Runs a specified program or command in a secondary window and in its own memory space. Title sets the title of the command prompt window. && Command following this symbol runs only if the command preceding the symbol succeeds. || Command following this symbol runs only if the command preceding the symbol fails. & Separates multiple commands on the command line. ( ) Groups commands. ^ Escape character. Allows typing command symbols as text. ; or , Separates parameters.

Page 4: W2K Cmd Line

Windows 2000 Command Line

Page 4 of 101

Changes to MS-DOS Commands This table lists changes and improvements to MS-DOS commands.

Command Changed features chcp Changes code pages for full-screen mode only. cmd Cmd.exe replaces Command.com. del New switches provide many more functions. dir New switches provide many more functions. diskcomp Switches /1 and /8 are not supported. diskcopy Switch /1 is not supported. doskey Available for all character-based programs that accept buffered input. Doskey has been improved by a series of

enhancements. format 20.8 MB optical drive supported. Switches /b, /s, and /u are not supported. label The symbols ^ and & can be used in a volume label. mode Extensive changes. more New switches provide many more functions. path The %PATH%environment variable appends the current path to a new setting at the command prompt. print Switches /b, /c, /m, /p, /q, /s, /t, and /u are not supported. prompt New character combinations allow you to add ampersands ($a), parentheses ($c and $f), and spaces ($s) to your

prompt. recover Recovers files only. rmdir New /s switch deletes directories containing files and subdirectories. sort Does not require TEMP environment variable. File size is unlimited. xcopy New switches provide many more functions.

Page 5: W2K Cmd Line

Windows 2000 Command Line

Page 5 of 101

Unavailable MS-DOS Commands The following MS-DOS commands are not available at the command prompt.

Command New procedure or reason for obsolescence assign Not supported in Windows 2000. backup Not currently supported. choice Not currently supported. ctty Not currently supported. dblspace Not supported. defrag Windows 2000 automatically optimizes disk use. To optimize a disk manually, right-click it in My Computer,

click Properties, and then, on the Tools tab, click Defragment Now. deltree The rmdir /s command deletes directories containing files and subdirectories. diskperf Not currently supported. dosshell Unnecessary with Windows 2000. drvspace The Drvspace program is not currently supported. emm386 Unnecessary with Windows 2000. fasthelp This MS-DOS 6.0 command is the same as the Windows 2000 command help. Windows 2000 also provides an

online command reference. fdisk Disk Management prepares hard disks for use with Windows 2000. include Multiple configurations of the MS-DOS subsystem are not supported. interlnk The Interlnk program is not supported. intersrv The Intersrv program is not supported. join Increased partition size and an improved file system eliminate the need to join drives. memmaker Windows 2000 automatically optimizes the MS-DOS subsystem's memory use. menucolor Multiple configurations of the MS-DOS subsystem are not supported. menudefault Multiple configurations of the MS-DOS subsystem are not supported. menuitem Multiple configurations of the MS-DOS subsystem are not supported. mirror Not supported in Windows 2000. msav The Msav program is not supported. msbackup Windows 2000 provides the Backup utility (in the Administrative Tools in Control Panel) for computers with

tape drives, or the xcopy command for computers without tape drives. mscdex It is unnecessary to configure the MS-DOS subsystem to use a CD-ROM drives. Windows 2000 provides access

to CD-ROM drives for the MS-DOS subsystem.

msd Use the System Information snap-in. To start System Information, click Start, click Run, and then type

msinfo32. numlock Not currently supported. power The Power utility is not supported. restore Not currently supported. scandisk The Scandisk utility is not supported. smartdrv Windows 2000 automatically provides caching for the MS-DOS subsystem. submenu Multiple configurations of the MS-DOS subsystem are not supported. sys Windows 2000 will not fit on a standard 1.2 MB or 1.44 MB floppy disk. undelete Not supported in Windows 2000. unformat Not supported in Windows 2000. vsafe The Vsafe program is not supported.

Page 6: W2K Cmd Line

Windows 2000 Command Line

Page 6 of 101

Append Enables programs to open data files in specified folders as if these files were in the current folder. The specified folders are called appended folders because, for the sake of opening data files, they can be found as if they were appended to the current folder.

append [;] [[drive:]path[;...]] [/x:{on | off}][/path:{on | off}] [/e]

Parameters

;

Cancels the list of appended folders.

[drive:]path

Specifies the drive (if other than the current drive) and folder that you want to append to the current folder. You can specify multiple entries of [drive:]path, separating the entries with semicolons. When used by itself, append cancels the existing list of appended folders.

/x:{on | off}

Specifies whether the MS-DOS subsystem is to search appended folders when executing programs. If you use the /x:on switch, the program does search appended folders. If you use the /x:off switch, the program does not search appended folders. You can abbreviate /x:on to /x. If you want to specify /x:on, you must do it the first time you use append after starting your system. After that, you can switch between /x:on and /x:off.

/path:{on | off}

Specifies whether a program is to search appended folders for a data file when a path is already included with the name of the file the program is looking for. The default setting is /path:on.

/e

Assigns the list of appended folders to an environment variable named APPEND. This switch can be used only the first time you use append after starting your system. If you use /e, you can use the set command to display the list of appended folders. For information about environment variables, click set in the list.

Arp Displays and modifies the IP-to-Ethernet or token ring physical address translation tables used by the Address Resolution Protocol (ARP). This command is available only if the TCP/IP protocol has been installed.

arp -a [inet_addr] [-N [if_addr]]

arp -d inet_addr [if_addr]

arp -s inet_addr ether_addr [if_addr]

Parameters

-a

Displays current ARP entries by querying TCP/IP. If inet_addr is specified, only the IP and physical addresses for the specified computer are displayed.

-g

Identical to -a.

inet_addr

Specifies an IP address in dotted decimal notation.

-N

Displays the ARP entries for the network interface specified by if_addr.

if_addr

Specifies, if present, the IP address of the interface whose address translation table should be modified. If not present, the first applicable interface is used.

-d

Deletes the entry specified by inet_addr.

-s

Adds an entry in the ARP cache to associate the IP address inet_addr with the physical address ether_addr. The physical address is given as 6 hexadecimal bytes separated by hyphens. The IP address is specified using dotted decimal notation. The entry is permanent, that is, it is automatically removed from the cache after the time-out expires.

Page 7: W2K Cmd Line

Windows 2000 Command Line

Page 7 of 101

ether_addr

Specifies a physical address.

Assoc Displays or modifies file name extension associations.

assoc [.ext[=[filetype]]]

Parameters

none

Displays the current file associations. To view associations one screen at a time, append the |more command. To redirect the output to a file, append the >filename.ext command.

.ext

Specifies the file name extension for which you would like to view or change the associations.

• Type assoc .ext to view the current association for a file name extension. • Type assoc . ext= to delete the association for a file name extension.

filetype

Specifies the file type with which you want Windows 2000 to associate the specified file name extension.

At Lists scheduled commands or schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the at command.

at [\\computername] [[id] [/delete] | /delete [/yes]]

at [\\computername] time [/interactive] [/every:date[,...] | /next:date[,...]] command

Parameters

none

Used without parameters, at lists scheduled commands.

\\computername

Specifies a remote computer. If this parameter is omitted, the commands are scheduled on the local computer.

id

Specifie the identification number assigned to a scheduled command.

/delete

Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.

/yes

Forces a yes answer to all queries from the system when deleting scheduled events.

time

Specifies the time when the command is to run. Time is expressed as hours:minutes in 24-hour notation (00:00 [midnight] through 23:59).

/interactive

Allows the job to interact with the desktop of the user who is logged on at the time the job runs.

/every:date[,...]

Runs the command on every specified day or days of the week or month (for example, every Thursday, or the third day of every month). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas. If date is omitted, the current day of the month is assumed.

/next:date[,...]

Runs the specified command on the next occurrence of the day (for example, next Thursday). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas. If date is omitted, the current day of the month is assumed.

command

Page 8: W2K Cmd Line

Windows 2000 Command Line

Page 8 of 101

Specifies the Windows 2000 command, program (.exe or .com file), or batch program (.bat or .cmd file) to be run. When the command requires a path as an argument, use the absolute path, that is, the entire path beginning with the drive letter. If the command is on a remote computer, specify UNC notation for the server and share name, rather than a remote drive letter. If the command is not an executable (.exe) file, you must precede the command with cmd /c; for example:

cmd /c dir > c:\test.out

Atmadm Monitors connections and addresses registered by the ATM Call Manager on an asynchronous transfer mode (ATM) network. You can use the utility to display statistics for incoming and outgoing calls on ATM adapters.

atmadm [-c][-a] [-s]

Parameters

-c

Displays call information for all current connections to the ATM network adapter installed on this computer.

-a

Displays the registered ATM network service access point (NSAP) address for each adapter installed in this computer.

-s

Displays statistics for monitoring the status of active ATM connections.

Attrib Displays or changes file attributes.

This command displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or directories.

attrib [+r|-r] [+a|-a] [+s|-s] [+h|-h] [[drive:][path] filename] [/s[/d]]

Parameters

+r

Sets the read-only file attribute.

-r

Clears the read-only file attribute.

+a

Sets the archive file attribute.

-a

Clears the archive file attribute.

+s

Sets the file as a system file.

-s

Clears the system file attribute.

+h

Sets the file as a hidden file.

-h

Clears the hidden file attribute.

[[drive:][path] filename]

Specifies the location and name of the directory, file, or set of files you want to process. You can use wildcard characters (? and *) in the filename parameter to display or change the attributes for a group of files.

/s

Processes matching files in the current directory and all of its subdirectories.

/d

Processes directories.

Page 9: W2K Cmd Line

Windows 2000 Command Line

Page 9 of 101

Batch commands Select a command to get more information.

call goto setlocal echo if shift endlocal pause % for rem

Batch programs (also called batch files) allow you to simplify routine or repetitive tasks. A batch program is an unformatted text file that contains one or more commands and has a .bat or .cmd file name extension. When the file name is typed at the command prompt, the commands in the file are executed sequentially.

Any command can be included in a batch file. In addition, the for, goto, and if commands allow conditional processing of the commands in the batch file. For example, the if command carries out a command based on the results of a condition. Other commands allow you to control input and output and call other batch programs. The replaceable parameter, %, expands batch script argument variables.

Break Windows 2000 does not use this command. It is accepted only for compatibility with files from MS-DOS.

Buffers Windows 2000 and the MS-DOS subsystem do not use this command. It is accepted only for compatibility with files from MS-DOS.

Cacls Displays or modifies access control lists (ACLs) of files. You can specify more than one file or user in a command.

cacls filename [/t] [/e] [/c] [/g user:perm] [/r user [...]] [/p user:perm [...]] [/d user [...]]

Parameters

filename

Displays ACLs of specified files.

/t

Changes ACLs of specified files in the current directory and all subdirectories.

/e

Edits an ACL instead of replacing it.

/c

Continues changing ACLs, ignoring errors.

/g user:perm

Grant specified user access rights. Perm can be:

n None

r Read

c Change (Write)

f Full Control

/r user

Revoke specified user access rights.

/p user:perm

Replace specified user access rights. Perm can be:

n None

r Read

c Change (Write)

f Full Control

Page 10: W2K Cmd Line

Windows 2000 Command Line

Page 10 of 101

/d user

Denies specified user access.

Call Calls one batch program from another without causing the parent batch program to stop. The call command now accepts labels as the target of the call.

call [drive:][path] filename [batch-parameters]

call :label [arguments]

Parameters

[drive:][path] filename

Specifies the location and name of the batch program you want to call. The filename parameter must have a .bat or .cmd extension.

batch-parameters

Specifies any command-line information required by the batch program. See below under the arguments parameter for extensions to batch-parameters.

:label

Specifies the label to which you want batch program control to jump. Using the call command with this parameter creates a new batch file context and passes control to the statement after the specified label. The first time the end of the batch file is encountered (after jumping to the label), control returns to the statement after the CALL statement. The second time the end of the batch file is encountered, the batch script is exited. For a description of the goto :eof extension that will allow you to return from a batch script, click goto in the list.

Chcp Displays the number of the active console code page, or changes the active console code page that Windows 2000 is to use for the console. Only the OEM code page installed with Windows 2000 will appear correctly in a command prompt window using Raster fonts. Other code pages will appear correctly in full-screen mode or command prompt windows that are using TrueType fonts.

chcp [nnn]

Parameter

none

Used without parameters, chcp displays the number of the active console code page.

nnn

Specifies the code page. The following list shows each code page that Windows 2000 supports and its Country/Region or language:

437 United States 850 Multilingual (Latin I) 852 Slavic (Latin II) 855 Cyrillic (Russian) 857 Turkish 860 Portuguese 861 Icelandic 863 Canadian-French 865 Nordic 866 Russian 869 Modern Greek

Chdir (Cd) Displays the name of the current directory or changes the current folder.

chdir [/d] [drive:][path] [..]

-or-

cd [/d] [drive:][path] [..]

Parameters

none

Page 11: W2K Cmd Line

Windows 2000 Command Line

Page 11 of 101

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.

[/d]

Changes the current drive in addition to changing the current directory for a drive. With command extensions enabled (the default in Windows 2000), the current directory name is converted to use the same case as the actual directory names on the

disk. So, for example, cd C:\Temp sets the current directory to C:\Temp if that is its name on the disk.

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

Chkdsk Creates and displays a status report for a disk, based on the file system used. Chkdsk also lists and corrects errors on the disk. If chkdsk cannot lock the drive it will offer to check it the next time the computer restarts.

Issuing the chkdsk command on a fixed disk requires you be a member of the Administrators group.

chkdsk [drive:][[path] filename] [/f] [/v] [/r] [/l[:size]] [/x]

Parameters

none

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

drive:

Specifies the drive that contains the disk that you want chkdsk to check.

[path] filename

Specifies the location and name of a file or set of files that you want chkdsk to check for fragmentation. You can use wildcard characters (* and ?) to specify multiple files.

/f

Fixes errors on the disk. The disk must be locked. If chkdsk cannot lock the drive it will offer to check it the next time the computer restarts.

/v

Displays the name of each file in every directory as the disk is checked.

/r

Locates bad sectors and recovers readable information. The disk must be locked.

/l[:size]

NTFS only. Changes the log file size to the size you enter. Displays the current size if you don't enter a new one.

/x

NTFS only. Forces the volume to dismount first, if necessary. All open handles to the volume are then invalid. This switch also includes the functionality of the /f switch.

/i

NTFS only. Performs a less vigorous check of index entries, reducing the amount of time needed to run chkdsk.

/c

NTFS only. Skips the checking of cycles within the folder structure, reducing the amount of time needed to run chkdsk.

Chkntfs Displays or specifies whether automatic system checking is scheduled to be run on a FAT, FAT32, or NTFS volume when the computer is started.

You must be a member of the local Administrators group to use the chkntfs command.

chkntfs [/t[:time]] [/x] [/c] volume: [...]

chkntfs /d

Parameters

volume:

Page 12: W2K Cmd Line

Windows 2000 Command Line

Page 12 of 101

Displays a message identifying the file system of the specified volume and, if automatic file checking is scheduled to be run, displays a message indicating whether the volume has been corrupted, requiring chkdsk to be run.

/d

Restores all chkntfs default settings, except the countdown time for automatic file checking. Default behavior is to check all volumes when the computer is started.

/t

Displays or changes the countdown time for automatic file checking. For example:

chkntfs /t Displays the countdown time for automatic file checking.

chkntfs /t:30 Changes the countdown time to 30 seconds.

Though you can set countdown time to zero, doing so prevents the user from cancelling a potentially time-consuming automatic file check.

/x

Excludes the specified volume from being checked when the computer starts, even if the volume is marked as requiring chkdsk to be run.

This command is not accumulative. If you enter it more than once, it overrides the previous entry. To exclude multiple volumes, list them all in one command. For example:

chkntfs /x e: f: excludes both the e and f volumes.

chkntfs /x e:, followed by chkntfs /x f:, will exclude only the f volume from being checked.

/c

Schedules the specified volume to be checked when the computer starts.

This command is accumulative. If you want only the specified volume to be checked, first reset the defaults to clear any previous commands, then, exclude all volumes from being checked, and finally, schedule automatic file-checking on the desired volume.

For example, to schedule automatic file checking on the d volume only, enter the following:

chkntfs /d (This restores the default settings.)

chkntfs /x c: d: e: (This excludes the c, d, and e volumes from being checked.)

chkntfs /c d: (This schedules automatic file checking on the d volume.)

Cipher Displays or alters the encryption of folders and files on NTFS volumes.

cipher [/e| /d] [/s:dir] [/a][/i] [/f] [/q] [/h] [pathname [...]]

Parameters

none

Used without parameters, displays the encryption state of the current folder and any files it contains.

/e

Encrypts the specified folders. Folders will be marked so that files added to the folder later will be encrypted.

/d

Decrypts the specified folders. Folders will be marked so that files added to the folder later will not be encrypted.

/s: dir

Performs the selected operation on folders in the specified folder and all subfolders.

/a

Performs the selected operation on files with the specified names. If there is no matching file, this parameter is ignored.

/i

Continues performing the specified operation even after errors have occurred. By default, cipher stops when an error is encountered.

/f

Forces the encryption or decryption of all specified objects. By default, files that have already been encrypted or decrypted are skipped.

/q

Page 13: W2K Cmd Line

Windows 2000 Command Line

Page 13 of 101

Reports only the most essential information.

/h

Displays files with hidden or system attributes. By default, these files are not encrypted or decrypted.

pathname

Specifies a pattern, file, or folder.

Cls Clears the screen.

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

cls

Cluster The basic cluster syntax is:

cluster [[/cluster:]cluster name] /option

The cluster name is optional. If you do not specify a cluster, Cluster.exe attempts to connect to the cluster running on the node that is running Cluster.exe.

If no option is specified, the default option is /help.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or c, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

The following table describes the available cluster options:

Option Use to... /rename:cluster name Rename a cluster. /version Display the Cluster service version number. /quorum[resource][:resource name] [/path:path] [/maxlogsize:maximum size in kilobytes]

Change the name or location of the quorum resource or the size of the quorum log.

/reg[admin]ext:admin extension dll [,admin extension dll...] Register a Cluster Administrator extension DLL with the cluster.

/unreg[admin]ext:admin extension dll [,admin extension dll...]

Unregister a Cluster Administrator extension DLL from the cluster.

/list:[domain name] Display a list of clusters in the computer's domain or a specified domain. Do not use the cluster name with this option.

/properties [property list] View or set the cluster common properties. For more information on property lists, see Property lists.

/privproperties [property list] View or set the cluster private properties. For more information on property lists, see Property lists.

/? or /help Display cluster syntax. For example, to rename a cluster called OpsClust to OpsClust1, type the following at the Windows 2000 command prompt:

cluster opsclust /rename:opsclust1

Page 14: W2K Cmd Line

Windows 2000 Command Line

Page 14 of 101

Cluster common property names

The following table describes the common cluster property names, their uses, and valid settings:

Common property names Use AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extension for

the cluster object. DefaultNetworkRole Specifies the default role to assign to networks. Description Specifies administrative description of the cluster. Security Describes Windows 2000-compatible security descriptor. SecurityDescriptor Describes Windows NT-SP4 and Windows 2000-compatible security descriptor. Groups\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the groups. NetInterfaces\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the netinterfaces. Networks\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the networks. Nodes\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the nodes. Resources\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the resources. ResourceTypes\AdminExtensions Describes one or more class identifiers (CLSIDs) of Cluster Administrator extensions for

the resource types. EnableEventLogReplication Specifies if Event Log Replication is enabled or disabled cluster wide. (True (1) means

enabled; False (0) means disabled.)

Cluster private property name

By default, there are no private properties for cluster. Software vendors can add private properties to extend cluster functionality.

Cluster commands overview You can use cluster commands to administer server clusters from the Windows 2000 command prompt. You can also call the program Cluster.exe from command scripts to automate many cluster administration tasks. Cluster.exe is provided on all Windows 2000 computers.

You can use Cluster.exe to administer clusters from a node of the cluster, from nodes of other clusters, or from other computers running Windows NT 4.0 with Service Pack 3 or later.

The following rules apply when entering commands from the command prompt:

• You must use quotation marks around all names that contain spaces and special characters. Examples of special characters are: the minus sign (-), the slash mark (/), quotation marks ("), the colon (:), the comma (,), and the equal sign (=). For other examples, see the cluster commands in .

• When setting properties to True or False, specify 1 (one) for True and 0 (zero) for False. • You specify the local cluster when you enter a PERIOD (.) in the command for cluster name. • You can specify multiple options for one command line. Cluster.exe processes options from left to right. If an option

fails, the command will stop executing at the failed option. • Use double quotation marks (") in a string that has two consecutive double quotation marks (""). The following

example shows double quotation marks in a string:

cluster resource AResource /priv aProp="a """

Page 15: W2K Cmd Line

Windows 2000 Command Line

Page 15 of 101

This topic describes the cluster commands, command abbreviations, and property lists:

• Cluster • Cluster node • Cluster group • Cluster network • Cluster netinterface • Cluster resource • Cluster resourcetype • Cluster command abbreviations • Property lists

Cluster group The basic cluster group syntax is:

cluster [[/cluster:]cluster name] group group name /option

The cluster name is optional. If no option is specified, the default option is /status.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or group, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

With /moveto, /online, and /offline , the option /wait[:timeout in seconds] specifies how long Cluster.exe waits before canceling the command if it does not successfully complete. If a time-out is not specified, Cluster.exe waits indefinitely or until the group state changes.

The following table describes the available cluster group options:

Option Use to... /status Display the status of a group (Online, Offline, or Partially Online). The group name is

optional. If you do not provide a group name, status for all groups is displayed. /create Create a new group. /delete Delete a group. /rename: new group name Rename a group. /move[to] [:node name] [/wait [:timeout in seconds]] Move a group to another node. /online [:node name] [/wait [:timeout in seconds]] Bring a group online. /offline[:node name] [/wait [:timeout in seconds]] Take a group offline.

/properties [property list] View or set the group common properties. The group name is optional. Properties for all groups are displayed if group name is not provided. For more information on property lists, see Property lists.

/privproperties [property list] View or set the group private properties. The group name is optional. Private properties for all groups are displayed if you do not provide a group name. For more information on property lists, see Property lists.

/listowners Display a list of preferred owners. /setowners:node name[,node name...] Specify a preferred owner. /? or /help Display cluster group syntax. For example, to move a group called Disk Group 1 on the OpsClus1 cluster from OpsNode1 to OpsNode2, type the following at the Windows 2000 command prompt:

cluster opsclust group "disk group 1" /moveto:opsnode2

Page 16: W2K Cmd Line

Windows 2000 Command Line

Page 16 of 101

Cluster group common property names

The following table describes the common cluster group property names, their uses, and valid settings:

Common property names Use

Name Name of the cluster group object. Description Describes a group. PersistentState Describes the last known persistent state of a group (1, (true) means online; 0 (false) means

offline). FailoverThreshold Specifies the number of times the Cluster service attempts to fail over a group before it concludes

that the group cannot be brought online anywhere in the cluster. FailoverPeriod Specifies the interval (in hours) over which the Cluster service attempts to fail over a group. AutoFailbackType Set to ClusterGroupPreventFailback (0) to prevent failback. Set to

ClusterGroupAllowFailback (1) to allow failback. FailbackWindowStart Specifies the start time (on a 24-clock) for failback of a group to its preferred node. These values

must be between 0 (midnight) and 23 (11:00 p.m.) in local time. For immediate failback, set to -1.

FailbackWindowEnd Specifies the end time (on a 24-hour clock) for failback of a group to its preferred node. These values must be between 0 (midnight) and 23 (11:00 p.m.) in local time. For immediate failback, set to -1.

Cluster group private property name

By default, there are no private properties for cluster group. Software vendors can add private properties to extend cluster functionality.

Cluster node The basic cluster node syntax is:

cluster [[/cluster:]cluster name] node node name /option

The cluster name is optional. If no node name and no options are specified, the default option is /status.

If the name of your cluster is also a cluster command or its abbreviation, such as node, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

The following table describes the available cluster node options:

Option Use to... /status Display the cluster node status (Up, Down, or Paused). The node name is optional. The status of all

nodes is displayed if you do not provide a node name. /pause Pause a node. /resume Resume a paused node. /evict Evict a node from a cluster. /listinterfaces List the node's network interfaces. /properties [property list]

View or set the node common properties. The node name is optional. If you do not specify a node name, properties for all nodes are displayed. For more information on property lists, see Property lists.

/privproperties [property list]

View or set the node private properties. The node name is optional. If you do not provide a node name, private properties for all nodes are displayed . For more information on property lists, see Property lists.

/? or /help Display cluster node syntax. For example, to display the status of a node named OpsNode1, type the following at the Windows 2000 command prompt:

cluster node opsnode1 /status

Page 17: W2K Cmd Line

Windows 2000 Command Line

Page 17 of 101

Cluster node common property names

The following table describes the common cluster node property names, their uses, and valid settings:

Common property names Use Description Describes a node.

EventEnableLogReplication Specifies if Event Log Replication is enabled or disabled on a node. (True (1) means enabled; False (0) means disabled.) If the cluster Event Log Replication is disabled, Event Log Replication on a node is disabled, regardless of property setting.

Cluster node private property name

By default, there are no private properties for cluster node. Software vendors can add private properties to extend cluster functionality.

Cluster netinterface The basic cluster netinterface syntax is:

cluster [[/cluster:]cluster name] netinterface /node: node name /network: network name /option

The cluster name is optional. If no option is specified, the default option is /status.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or c, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

The following table describes the available cluster netinterface options:

Option Use to...

/status Display the status for cluster network interface. The network name and node name are optional. If you do not provide the network name and node name, the status of all cluster network interfaces is displayed.

/properties [property list]

View or set the network interface common properties. The network name and node name are optional. Properties for all network interfaces are displayed if you do not provide a network name and node name. For more information on property lists, see Property lists

/privproperties [property list]

View or set the network interface private properties. The network name and node name are optional. If you do not provide a network name and node name, the private properties for all network interfaces are displayed. For more information on property lists, see Property lists.

/? or /help Display cluster netinterface syntax.

Cluster netinterface common properties

The following table describes the common cluster netinterface property names, their uses, and valid settings:

Name Use Adapter Uniquely identifies the adapter in the cluster. AdapterID A Globally Unique Identifier (GUID) for the adapter in the cluster. Address The primary network address used by the network interface. Description Optional description of the network interface. Name Name of the cluster network interface object. Network The name of the network to which the network interface is connected. Node The name of the node on which the network interface is installed.

Page 18: W2K Cmd Line

Windows 2000 Command Line

Page 18 of 101

Cluster netinterface private properties

By default, there are no private properties for cluster netinterface. Software vendors can add private properties to extend cluster functionality.

Cluster network The basic cluster network syntax is:

cluster [[/cluster:]cluster name] network network name /option

The cluster name is optional. If no option is specified, the default option is /status.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or network, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

The following table describes the available cluster network options:

Option Use to... /status Display the status for cluster network. The network name is optional. If you do not provide a network

name, the status of all cluster networks is displayed. /properties [property list]

View or set the network common properties. The network name is optional. If you do not provide a network name the properties for all networks are displayed. For more information on property lists, see Property lists

/privproperties [property list]

View or set the network private properties. The network name is optional. Private properties for all networks are displayed if you do not provide a network name. For more information on property lists, see Property lists

/rename:new name Rename the network. /listinterfaces List network interfaces associated with the network. /? or /help Display cluster network syntax.

Cluster network common property names

The following table describes the common cluster network property names, their uses, and valid settings:

Property name Use

Name The name of the network. The cluster uses the same name as the Network and Dial-up Connections folder. For more information, see Name coordination between Cluster service and Network and Dial-up Connections.

Address Provides the address for the entire network or subnet. AddressMask The subnet mask for the network. Description A description of the network. Role The communication role of the network. For more information on network roles, see Networks.

Cluster network private properties

By default, there are no private properties for cluster network. Software vendors can add private properties to extend cluster functionality.

Page 19: W2K Cmd Line

Windows 2000 Command Line

Page 19 of 101

Cluster resource The basic cluster resource syntax is:

cluster [[/cluster:]cluster name] resource resource name /option

The cluster name is optional. If no option is specified, the default option is /status.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or resource, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

With /online and /offline the option /wait[:timeout in seconds] specifies how long Cluster.exe waits before canceling the command if it does not successfully complete. If no time-out is specified, Cluster.exe waits indefinitely or until the resource state changes.

The following table describes the available cluster resource options:

Option Use to...

/status Display the status of a cluster resource (Online, Offline, or Failed). The resource name is optional. If you do not provide a resource name, the status of all cluster resources is displayed.

/create /group: group name /type: resource type [/separate] Create a new resource in a specified group. Use /separate to specify that the resource should run in a separate Resource Monitor.

/delete Delete a resource. /rename: new resource name Rename a resource. /addowner:node name Add a node name to the list of possible owners. /removeowner:node name Remove a node name from the list of possible owners. /listowners Display a list of possible owners. /moveto:group Move the resource to a different group.

/properties [property list] View or set the resource common properties. The resource name is optional. If you do not provide a resource name, properties for all resources are displayed. For more information on property lists, see Property lists.

/privproperties [property list] View or set the resource private properties. Resource name is optional. If you do not provide a resource name, private properties for all resources are displayed. For more information on property lists, see Property lists.

/fail Initiate resource failure. /online [/wait[:timeout in seconds]] Bring the resource online. /offline [/wait[:timeout in seconds]] Take the resource offline. /listdependencies List the dependencies for a resource. /adddependency: resource Add a dependency for a resource. /removedependency:resource Remove a dependency for a resource. /addcheckpoints:key[\subkey...][,key[\subkey...]...] Add a registry checkpoint for a resource. /removecheckpoints:key[\subkey...][,key[\subkey...]...] Remove a registry checkpoint for a resource.

/checkpoints List registry checkpoints for a resource. The resource name is optional. Checkpoints for all cluster resources are displayed if you do not provide a resource name.

/addcryptocheckpoints:key[\subkey...][,key[\subkey...]...] Add a cryptographic key checkpoint for a resource. /removecryptocheckpoints:key[\subkey...][,key[\subkey...]...] Remove a cryptographic key checkpoint for a resource.

/cryptocheckpoints List cryptographic key checkpoints for a resource. The resource name is optional. If you do not provide a resource name, checkpoints for all cluster resources are displayed.

/? or /help Display cluster resource syntax. For example, to create a Print Spooler resource in the Ops Print Spoolers group, type the following at the Windows 2000 command prompt:

cluster resource /create /group:"Ops Print Spoolers" /Type:"print spooler"

Page 20: W2K Cmd Line

Windows 2000 Command Line

Page 20 of 101

Cluster resource common property names

The following table describes the common cluster resource property names, their uses, and valid settings:

Common property names Use

Name Name of the cluster resource object. Description Describes a resource. Type Specifies the resource type. DebugPrefix Specifies the appropriate debugger for the resource. For more information, see the Microsoft

Platform Software Development Kit. SeparateMonitor Indicates whether or not a resource shares a Resource Monitor. Valid values are True (1) and False

(0). PersistentState Describes the last known persistent state of a resource. In order to save the resource's

PersistentState property, the resource must be offline.

LooksAlivePollInterval Recommended interval in milliseconds that the Cluster service polls a resource to determine if it appears operational. If a value is not specified, a default value is taken from the LooksAlivePollInterval property for the resource type.

IsAlivePollInterval Interval (in milliseconds) that the Cluster service polls a resource to determine if it is operational. If a value is not specified, a default value is taken from the IsAlivePollInterval property for the specific resource type. IsAlivePollInterval cannot be zero.

RestartAction

Describes the action to perform if the resource fails. The choices are:

ClusterResourceDontRestart (0): Do not restart following a failure.

ClusterResourceRestartNoNotify (1): If the resource exceeds its restart threshold within its restart period, the Cluster service does not attempt to failover the group to another node.

ClusterResourceRestartNotify (2): If the resource exceeds its restart threshold within its restart period, the Cluster service attempts to fail over the group to another node.

If you do not enter a value, the default allows the resource to affect the group, which can cause the group to fail over to another system.

RestartThreshold Specifies how many times the Cluster service attempts to restart the resource in the RestartPeriod before failing over the group.

RestartPeriod Specifies the amount of time allowed for the restart attempts to reach the RestartThreshold before the Cluster service fails over the group.

PendingTimeout The amount of time that a Pending Online or Pending Offline resource has to resolve its status before the Cluster service puts the resource in Offline or Failed status.

The default value is 3 minutes.

Cluster resource private property name

Some resources store private properties. For example, to see the disk signature for the Disk L: resource, type the following at the Windows 2000 command prompt:

cluster resource "disk l:" /priv

Page 21: W2K Cmd Line

Windows 2000 Command Line

Page 21 of 101

Cluster resourcetype The basic cluster resourcetype syntax is:

cluster [[/cluster:]cluster name] resourcetype resource type display name /option

The cluster name is optional. If no option is specified, the default option is /list.

If the name of your cluster is also a cluster command or its abbreviation, such as cluster or c, use /cluster: to explicitly specify the cluster name. For a list of all the cluster commands, see .

The following table describes the available cluster resource options:

Option Use to...

/list List the available installed cluster resource types. Resource type display name is optional. If you do not provide a resource type display name, all installed resource types are listed.

/listowners Display a list of preferred owners. /create /DllName:dllname [/type:type name] [/IsAlive: interval-millisecond] [/LooksAlive:interval-millisecond]

Create a resource type.

/delete [/type] Delete a resource type. If the resource DLL cannot be accessed by the Cluster service, specify the resource type name with the /type option instead of specifying the resource type display name.

/properties [property list] View or set the resourcetype common properties. Resource type display name is optional. Properties for all resourcetypes are displayed if you do not provide a resource type display name. For more information on property lists, see Property lists.

/privproperties [property list] View or set the resourcetype private properties. The resource type display name is optional. If you do not provide a resource type display name, the private properties for all resourcetypes are displayed. For more information on property lists, see Property lists.

/? or /help Display cluster resourcetype syntax. For example, to display the properties of the Generic Application resource type on the OpsClust1 cluster, type the following at the Windows 2000 command prompt:

cluster opsclust1 resourcetype "generic application" /properties

Cluster resourcetype common property names

The following table describes the common cluster resourcetype property names, their uses, and valid settings:

Common Property Names Use

Name Changes a resource type display name. Description Changes the text that describes a resource type. DllName Specifies the name of the dynamic-link library (DLL) for a specific resource type. DebugPrefix Specifies the appropriate debugger for the resource type. For more information, see the Microsoft

Platform Software Development Kit. DebugControlFunctions Specifies if debugger breakpoint is set at the resource control function. (True (1) it is set; False

(0) it is not set.) AdminExtensions Describes one or more class identifiers (CLSID) for Cluster Administrator extensions. LooksAlivePollInterval Specifies the interval (in milliseconds) that the Cluster service polls resources of a particular

resource type to determine if the resources appear operational. IsAlivePollInterval Specifies the interval (in milliseconds) that the Cluster service polls resources of a particular

resource type to determine if the resources are operational.

Cluster resourcetype private property name

By default, there are no private properties for cluster resourcetype. Software vendors can add private properties to extend cluster functionality.

Page 22: W2K Cmd Line

Windows 2000 Command Line

Page 22 of 101

Cmd Starts a new instance of the Windows 2000 command interpreter, Cmd.exe.

A command interpreter is a program that displays the command prompt at which you type commands. Use the exit command to stop the new command interpreter and return control to the old one.

cmd [ [/c | /k] [/q] [/a | /u] [/t:fg] [/x | /y] string]

Parameters

/c

Carries out the command specified by string and then stops.

/k

Carries out the command specified by string and continues.

/q

Turns the echo off.

/a

Creates ANSI output.

/u

Creates Unicode output.

/t:fg

Sets the foreground and background colors. (For more information, click color in the list.)

/x

Enables extensions to the Windows 2000 version of Cmd.exe, to provide a richer shell programming environment. The following commands use the extensions: del (erase), color, cd (chdir), md (mdir), prompt, pushd, popd, set, setlocal, endlocal, if, for, call, shift, goto, start, assoc, and ftype. For details, see the Help for each command.

/y

Disables extensions to the Windows 2000 version of Cmd.exe, for backward compatibility reasons. The extensions are enabled by default.

string

Specifies the command you want to carry out.

Codepage Selects the code pages that the system will use for the MS OS/2 subsystem. To use this command, place it in your OS/2 C:\Config.sys file.

codepage=xxx[,yyy]

Parameters

xxx

Specifies the first code page. This must be a three-digit number from this list:

437 United States 850 Multilingual (Latin I) 852 Slavic (Latin II) 855 Cyrillic (Russian) 857 Turkish 860 Portuguese 861 Icelandic 863 Canadian-French 865 Nordic 866 Russian 869 Modern Greek

yyy

This parameter is not used by the OS/2 subsystem. It is accepted only for compatibility with files from MS OS/2 version 1.3 or earlier.

Page 23: W2K Cmd Line

Windows 2000 Command Line

Page 23 of 101

Color Sets the default console foreground and background colors.

color bf

Parameters

bf

Specifies color attributes of console output. b is a hexadecimal digit that specifies the background color; f specifies the foreground. Hexadecimal digits have the following values:

0 Black

1 Blue

2 Green

3 Aqua

4 Red

5 Purple

6 Yellow

7 White

8 Gray

9 Light blue

A Light green

B Light aqua

C Light red

D Light purple

E Light yellow

F Bright white

For example, color fc produces light red on bright white.

If no argument is given, this command restores the color to what it was when Cmd.exe started. This value comes from the current console window, the /t command line switch, or from the DefaultColor registry value.

If the specified foreground and background values are the same, color returns ERRORLEVEL 1.

Command symbols and filter commands Select a topic to get more information.

Redirection ( > < >> )

Filter Commands ( | more, sort, find )

Conditional Processing Symbols (& && || () ^ )

Comp Compares the contents of two files or sets of files byte by byte.

Comp can compare files on the same drive or on different drives, and in the same directory or in different directories. As comp compares the files, it displays their locations and file names.

comp [data1] [data2] [/d] [/a] [/l] [/n=number] [/c]

Parameters

data1

Specifies the location and name of the first file or set of files you want to compare. You can use wildcard characters (* and ?) to specify multiple files.

data2

Specifies the location and name of the second file or set of files you want to compare. You can use wildcard characters (* and ?) to specify multiple files.

/d

Displays differences in decimal format. (The default format is hexadecimal.)

Page 24: W2K Cmd Line

Windows 2000 Command Line

Page 24 of 101

/a

Displays differences as characters.

/l

Displays the number of the line on which a difference occurs, instead of displaying the byte offset.

/n=number

Compares the first number of lines of both files, even if the files are different sizes.

/c

Performs a comparison that is not case-sensitive.

Compact Displays and alters the compression of files or directories on NTFS partitions.

compact [/c|/u] [/s[:dir]] [/a] [/q] [/i] [/f] [filename[...]]

Parameters

none

Used without parameters, compact displays the compression state of the current directory.

/c

Compresses the specified directory or file.

/u

Uncompresses the specified directory or file.

/s:dir

Specifies that the requested action (compress or uncompress) be applied to all subdirectories of the specified directory, or of the current directory if none is specified.

/a

Displays hidden or system files.

/q

Reports only the most essential information.

/i

Ignores errors.

/f

Forces compression or uncompression of the specified directory or file. This is used in the case of a file that was partly compressed when the operation was interrupted by a system crash. To force the file to be compressed in its entirety, use the /c and /f parameters and specify the partially compressed file.

filename

Specifies the file or directory. You can use multiple file names and wildcard characters (* and ?).

Conditional processing symbols Conditional processing symbols give you control over the execution of commands.

Processing Commands Conditionally

You use conditional processing symbols to issue multiple commands from the same prompt and to act based on the results of a command.

• The ampersand (&) separates multiple commands on one command line. • The parentheses groups multiple commands. • The semicolon or comma (; ,) separate command parameters. • The caret (^) cancels a subsequent command symbol's special meaning so you can use a command symbol as text. • The double ampersand (&&) causes the command following this symbol to run only if the command preceding the

symbol is successful. • The double pipe (||) causes the command following this symbol to run only if the command preceding the symbol

fails.

Page 25: W2K Cmd Line

Windows 2000 Command Line

Page 25 of 101

Convert Converts FAT and FAT32 volumes to NTFS. You cannot convert the current drive. If convert cannot lock the drive it will offer to convert it the next time the computer restarts.

convert [drive:] /fs:ntfs [/v]

Parameters

drive:

Specifies the drive to convert to NTFS.

/fs:ntfs

Specifies that the volume be converted to NTFS.

/v

Specifies verbose mode. All messages will be displayed during conversion.

Copy Copies one or more files to another location.

This command can also be used to combine files. When more than one file is copied, Windows 2000 displays each file name as the file is copied.

copy [/a | /b] source [/a | /b] [[/a | /b] + source [/a | /b] [+ ...]] [/v] [/n] [/y | /-y] [/z] [/a | /b] [destination [/a | /b]]

Parameters

source

Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a folder 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.

/a

Indicates an ASCII text file. When the /a switch precedes the list of file names on the command line, it applies to all files whose names follow the /a switch, until copy encounters a /b switch. In this case, the /b switch applies to the file whose name precedes the /b switch.

When the /a switch follows a file name, it applies to the file whose name precedes the /a switch and to all files whose names follow the /a switch, until copy encounters a /b switch. In this case the /b switch applies to the file whose name precedes the /b switch. An ASCII text file can use an end-of-file character (CTRL+Z) to indicate the end of the file. When combining files, copy treats files as ASCII text files by default.

/b

Indicates a binary file. When the /b switch precedes the list of file names on the command line, it applies to all files whose names follow the /b switch, until copy encounters an /a switch. In this case, the /a switch applies to the file whose name precedes the /a switch.

When the /b switch follows a file name, it applies to the file whose name precedes the /b switch and to all files whose names follow the /b switch, until copy encounters an /a switch. In this case, the /a switch applies to the file whose name precedes the /a switch.

The /b switch specifies that the command interpreter is to read the number of bytes specified by the file size in the directory. The /b switch is the default value for copy unless copy is combining files.

/v

Verifies that new files are written correctly.

/n

Uses a short file name, if available, when copying a file with a name longer than eight characters, or with a file extension longer than three characters.

/y

Suppresses prompting to confirm you want to overwrite an existing destination file.

The /y switch may be preset in the COPYCMD environment variable. You can override this setting by using /-y on the command line. The default is to prompt when replacing unless the copy command is being executed from within a batch script.

Page 26: W2K Cmd Line

Windows 2000 Command Line

Page 26 of 101

To append files, specify a single file for destination, but multiple files for source (using wildcard characters or file1+file2+file3 format).

/-y

Causes prompting to confirm you want to overwrite an existing destination file.

/z

Copies networked files in restartable mode. If the connection is lost during the copy phase (for example, if the server going offline severs the connection), it will resume after the connection has been re-established. Using this command switch also displays the percentage of the copy operation completed for each file.

For more information about the xcopy command, click xcopy in the list.

Country Enables the MS-DOS subsystem to use international time, dates, currency, case conversions, and decimal separators.

The country command configures the MS-DOS subsystem to recognize the character set and punctuation conventions observed when using one of the supported languages. Use the %systemroot%\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to load the Country/Region setting.

country=xxx[,[yyy][,[drive:][path] filename]]

Parameters

xxx

Specifies the Country/Region code.

yyy

Specifies the code page for the Country/Region.

[drive:][path] filename

Specifies the location and name of the file containing Country/Region information.

Date Displays the date or allows you to change the date from your computer or from a batch program. date [mm-dd-yy] date [/t] Parameters mm-dd-yy Sets the date you specify. Values for day, month, and year must be separated by periods (.), hyphens (-), or slash marks (/). mm can be 1 through 12 dd can be 1 through 31 yy can be 80 through 99 or 1980 through 2099 /t Tells the command to display the current date without prompting for a new date. For more information, click Time in the list.

Debug Starts Debug, a program you can use to test and debug MS-DOS executable files. debug [[drive:][path] filename [parameters]] Parameters [drive:][path] filename Specifies the location and name of the executable file you want to test. parameters Specifies any command-line information required by the executable file you want to test.

Page 27: W2K Cmd Line

Windows 2000 Command Line

Page 27 of 101

Debug subcommands Select a Debug command to get more information.

Debug: A (Assemble) Debug: C (Compare) Debug: D (Dump) Debug: E (Enter) Debug: F (Fill) Debug: G (Go) Debug: H (Hex) Debug: I (Input) Debug: L (Load) Debug: M (Move) Debug: N (Name) Debug: O (Output) Debug: P (Proceed) Debug: Q (Quit) Debug: r (Register) Debug: s (Search) Debug: T (Trace) Debug: U (Unassemble) Debug: W (Write) Debug: XA (Allocate Expanded Memory) Debug: XD (Deallocate Expanded Memory) Debug: XM (Map Expanded Memory Pages) Debug: XS (Display Expanded Memory Status)

Del (Erase) Deletes specified files. del [drive:][path] filename [ ...] [/p] [/f] [/s] [/q] [/a[:attributes]] erase [drive:][path] filename [ ...] [/p] [/f] [/s] [/q] [/a[:attributes]] Parameters [drive:][path] filename Specifies the location and name of the file or set of files you want to delete. Multiple file names can be used. File names can be separated by spaces, commas, or semicolons. /p Prompts you for confirmation before deleting the specified file. /f Forces deletion of read-only files. /s Deletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted. /q Quiet mode; does not prompt for delete confirmation. /a Deletes files based on specified attributes. attributes Can be any of the following file attributes:

Attribute Description r Read-only a Archive s System h Hidden - Prefix meaning "not" Note

If you disable command extensions (the default in Windows 2000 is to have command extensions enabled), the /s switch is reversed so that instead of displaying the names of files that are being deleted, it displays the names of any files that were not found.

Page 28: W2K Cmd Line

Windows 2000 Command Line

Page 28 of 101

Device Loads into memory the device driver you specify. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to load device drivers for the MS-DOS subsystem. device=[drive:][path] filename [dd-parameters] Parameters [drive:][path] filename Specifies the location and name of the device driver you want to load. [dd-parameters] Specifies any command-line information required by the device driver. For more information, click Devicehigh in the list.

Devicehigh Loads device drivers into the upper memory area. This frees more bytes of conventional memory for other programs. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to load device drivers for the MS-DOS subsystem. devicehigh=[drive:][path] filename [dd-parameters] To specify the minimum amount of memory that must be available before devicehigh attempts to load a device driver into the upper memory area, use the following syntax: devicehigh size=hexsize [drive:][path] filename [dd-parameters] Parameters [drive:][path] filename Specifies the location and name of the device driver you want to load into the upper memory area. dd-parameters Specifies any command-line information required by the device driver. hexsize Specifies the minimum amount of memory (the number of bytes, in hexadecimal format) that must be available before devicehigh attempts to load a device driver into the upper memory area. You must use both size and hexsize, as shown in the second syntax line. For more information, click Loadhigh or Device in the list.

Devinfo Prepares a device to use code pages. To use this command, place it in your OS/2 C:\Config.sys file. devinfo=devtype,subtype,[drive:][path]filename [,ROM=[[(]xxx[,yyy)]][,...]] Parameters devtype Specifies the type of device: keyboard, monitor, or parallel printer. Click Devinfo Notes in the list for possible values. subtype Specifies the style or model of the device. For a keyboard, this argument would specify the keyboard layout. Click Devinfo Notes in the list for possible values. drive:pathfilename Specifies the file that contains information about the code pages for that device. Click Devinfo Notes in the list for possible values. ROM= This parameter is not used by the OS/2 subsystem. It is accepted only for compatibility with files from MS OS/2 version 1.3 or earlier. xxx This parameter is not used by the OS/2 subsystem. It is accepted only for compatibility with files from MS OS/2 version 1.3 or earlier. yyy This parameter is not used by the OS/2 subsystem. It is accepted only for compatibility with files from MS OS/2 version 1.3 or earlier.

Dir Displays a list of a directory's files and subdirectories. dir [drive:][path][filename] [...] [/p] [/w] [/d] [/a[[:]attributes]][/o[[:]sortorder]] [/t[[:]timefield]] [/s] [/b] [/l] [/n] [/x] [/c] Parameters none Used without parameters or switches, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk, including their names and the date and time each was last modified. For files, dir displays the name extension and the size in bytes. Dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk. [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.

Page 29: W2K Cmd Line

Windows 2000 Command Line

Page 29 of 101

/p Displays one screen of the listing at a time. To see the next screen, press any key on the keyboard. /w Displays the listing in wide format, with as many as five file names or directory names on each line. /d Same as /w but files are sorted by column. /a[[:] attributes] Displays only the names of those directories and files with the attributes you specify. If you omit this switch, dir displays the names of all files except hidden and system files. If you use this switch without specifying attributes, dir displays the names of all files, including hidden and system files. The following list describes each of the values you can use for attributes. The colon (:) is optional. Use any combination of these values, and do not separate the values with spaces.

Value Description h Hidden files s System files d Directories a Files ready for archiving (backup) r Read-only files -h Files that are not hidden -s Files other than system files -d Files only (not directories) -a Files that have not changed since the last backup -r Files that are not read-only/o [[:]sortorder]

Controls the order in which dir sorts and displays directory names and file names. If you omit this switch, dir displays the names in the order in which they occur in the directory. If you use this switch without specifying sortorder, dir displays the names of the directories, sorted in alphabetic order, and then displays the names of files, sorted in alphabetic order. The colon (:) is optional. The following list describes each of the values you can use for sortorder. Use any combination of the values, and do not separate these values with spaces.

Value Description n In alphabetic order by name e In alphabetic order by extension d By date and time, earliest first s By size, smallest first g With directories grouped before files -n In reverse alphabetic order by name (Z through A) -e In reverse alphabetic order by extension (.ZZZ through .AAA) -d By date and time, latest first -s By size, largest first -g With directories grouped after files/t [[:]timefield]

The following list describes each of the values you can use for timefield. Controls which time field is displayed or used for sorting.

Value Description c Creation a Last access w Last written /s Lists every occurrence, in the specified directory and all subdirectories, of the specified file name. /b Lists each directory name or file name, one per line (including the file name extension). This switch displays no

heading information and no summary. The /b switch overrides the /w switch. /l Displays unsorted directory names and filenames in lowercase. This switch does not convert extended characters to

lowercase. /n Displays long list format with filenames on far right. /x Displays the short names generated for files on NTFS and FAT volumes. The display is the same as with the /n switch,

but short names are displayed after the long name. /c Displays the thousand separator in file sizes. For more information, click Tree in the list.

Page 30: W2K Cmd Line

Windows 2000 Command Line

Page 30 of 101

Diskcomp Compares the contents of two floppy disks. diskcomp [drive1: [drive2:]] Parameters drive1 Specifies the drive containing one of the floppy disks. drive2 Specifies the drive containing the other floppy disk. For more information, click Comp or Fc in the list.

Diskcopy Copies the contents of the floppy disk in the source drive to a formatted or unformatted floppy disk in the destination drive. diskcopy [drive1: [drive2:]] [/v] Parameters drive1 Specifies the drive containing the source disk. drive2 Specifies the drive containing the destination disk. /v Verifies that the information is copied correctly. Use of this switch slows the copying process. For information about copying one or more files, click copy in the list. For information about copying directories and subdirectories, click xcopy in the list.

Diskperf Controls the types of counters that can be viewed using System Monitor. diskperf [-y[d|v]|-n[d|v] [\\computername] Parameters none Reports whether disk performance counters are enabled on the local or specified computer and identifies the counters enabled: for physical drives, logical drives, or both. -y Sets the system to start both physical and logical disk performance counters when the system is restarted. -yd Enables disk performance counters used for measuring performance of physical drives when the system is restarted. This is the default setting. -yv Enables disk performance counters used for measuring performance of logical drives when the system is restarted. -n Sets the system to not use any disk performance counters when the system is restarted. -nd Disables disk performance counters for physical drives when the system is restarted. -nv Disables disk performance counters for logical drives when the system is restarted. computername Specifies the computer on which you want to see or set disk performance counter use. If a computer name is not specified, the local computer is assumed.

Dos Specifies that the MS-DOS subsystem is to maintain a link to the upper memory area (UMA) or is to load part of itself into the high memory area (HMA). dos=high|low[,umb|,noumb] dos=[high,|low,]umb|noumb Parameters high|low Specifies whether the MS-DOS subsystem should attempt to load a part of itself into the HMA. Use the high parameter to enable the MS-DOS subsystem to load itself into the HMA. Use the low parameter to keep all of the MS-DOS subsystem in conventional memory. The default setting is low. umb|noumb Specifies whether the MS-DOS subsystem should maintain a link between conventional memory and the UMA. The umb parameter provides this link. The noumb parameter disconnects this link. The default setting is noumb. For more information, click Devicehigh or Loadhigh in the list.

Page 31: W2K Cmd Line

Windows 2000 Command Line

Page 31 of 101

Doskey Calls the Doskey program, which recalls Windows 2000 commands, edits command lines, and creates macros. doskey [/reinstall] [/listsize=size] [/macros:[all | exename]] [/history] [/insert|/overstrike] [/exename=exename] [/macrofile=filename] [macroname=[text]] Parameters /reinstall Installs a new copy of Doskey. Clears the command history buffer. /listsize=size Specifies the maximum number of commands in the history buffer. /macros Displays a list of all Doskey macros. You can use a redirection symbol (>) with the /macros switch to redirect the list to a file. You can abbreviate the /macros switch as /m. all Displays Doskey macros for all executables. exename Displays Doskey macros for the specified executable. /history Displays all commands stored in memory. You can use a redirection symbol (>) with the /history switch to redirect the list to a file. You can abbreviate the /history switch as /h. /insert | /overstrike Specifies whether new text you type is to replace old text. If you use the /insert switch, new text that you type on a line is inserted into old text (as if you had pressed the INSERT key). If you use the /overstrike switch, new text replaces old text. The default setting is /overstrike. /exename=exename Specifies the program (executable) in which the Doskey macro will run. /macrofile=filename Specifies a file containing macros to install. macroname=[text] Creates a macro that carries out the commands specified by text. Macroname specifies the name you want to assign to the macro. Text specifies the commands you want to record. If text is left blank, macroname is cleared of any assigned commands.

Dosonly Prevents starting applications other than MS-DOS-based applications from the Command.com prompt. dosonly

Driveparm Windows 2000 and the MS-DOS subsystem do not take action for this command. It is accepted only for compatibility with MS-DOS files.

Echo Turns the command-echoing feature on or off, or displays a message. echo [on | off] [message] Parameters on | off Specifies whether to turn the command-echoing feature on or off. To display the current echo setting, use the echo command without a parameter. message Specifies text you want Windows 2000 to display on the screen. For more information, click Pause in the list.

Echoconfig Displays messages during the processing of the MS-DOS subsystem Config.nt and Autoexec.nt when the MS-DOS subsystem is invoked. If this command is not present, messages will not be displayed. This command must be in the MS-DOS subsystem Config.nt file. echoconfig

Edit Starts MS-DOS Editor, which creates and changes ASCII text files. edit [[drive:][path] filename] [/b] [/g] [/h] [/nohi] Parameters [drive:][path] filename

Page 32: W2K Cmd Line

Windows 2000 Command Line

Page 32 of 101

Specifies the location and name of an ASCII text file. If the file does not exist, MS-DOS Editor creates it. If the file exists, MS-DOS Editor opens it and displays its contents on the screen. /b Displays MS-DOS Editor in black and white. You use this option if MS-DOS Editor isn't displayed correctly on a monochrome monitor. /g Uses the fastest screen updating possible for a CGA monitor. /h Displays the maximum number of lines possible for the monitor you are using. /nohi Enables you to use eight-color monitors with MS-DOS Editor. Usually, Windows 2000 uses 16 colors.

Warning

MS-DOS Editor does not work if the file Qbasic.exe is not in the current directory, in the search path, or in the same directory as the file Edit.com. If you delete Qbasic.exe to save space on your hard disk, you cannot use MS-DOS Editor.

Note

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

Edlin Starts Edlin, a line-oriented text editor with which you can create and change ASCII files. Edlin numbers each line of the text file that is located in memory. You can use Edlin to insert, modify, copy, move, and delete lines of the file. If you want to use a full-screen editor, use the edit command. edlin [drive:][path] filename [/b] Parameters [drive:][path] filename Specifies the location and name of an ASCII file on a disk. If the file exists, Edlin opens it. If the file does not exist, Edlin creates a file in memory and uses the specified location and file name to create the file on a disk when you use the Edlin e command. /b Specifies that Edlin is to ignore the end-of-file character (CTRL+Z).

Edlin subcommands Select an Edlin command to get more information. Edlin: [line] Edlin: A (Append) Edlin: C (Copy) Edlin: D (Delete) Edlin: E (End) Edlin: I (Insert) Edlin: L (List) Edlin: M (Move) Edlin: P (Page) Edlin: Q (Quit) Edlin: R (Replace) Edlin: S (Search) Edlin: T (Transfer) Edlin: W (Write)

Endlocal Ends localization of environment changes in a batch file, restoring environment variables to their values before the matching setlocal command. There is an implicit endlocal command at the end of the batch file. endlocal If command extensions are enabled (the default in Windows 2000), the endlocal command restores the enabled/disabled state of command extensions to what it was before the matching setlocal command was executed.

Page 33: W2K Cmd Line

Windows 2000 Command Line

Page 33 of 101

Evntcmd Displays SNMP events. evntcmd [/?|/h] [/s sysname][/v number][/n] Parameters [/?|/h] Displays help for eventcmd. /s sysname Specifies the target system name for configuration. /v number Specifes the level of verbosity for evntcmd. 0=silent, 10=detailed. /n Specifies not to restart the SNMP service when it receives trap changes.

Exe2bin Converts .exe (executable) files to binary format. Exe2bin is included with Windows 2000 as a courtesy to software developers. It is not useful for general users. exe2bin [drive1:][path1]input-file [[drive2:][path2]output-file] Parameters [drive1:][path1]input-file Specifies the location and name of the input file to be converted. [drive2:][path2]output-file Specifies the location and name of the output file to be created.

Exit Quits the Cmd.exe program (the command interpreter) and returns to the program that started Cmd.exe, if one exists, or to the Program Manager. exit

Expand Expands one or more compressed files. This command is used to retrieve compressed files from distribution disks. expand [-r] source [destination] expand -d source.cab [-f:files] expand source.cab -f:files destination Parameters -r Renames expanded files. -d Displays a list of files in the source location. Does not expand or extract the files. -f:files Specifies the files in a cabinet (.cab) file you want to expand. Wildcards (* and ?) can be used. source Specifies the files to expand. Source can consist of a drive letter and colon, a directory name, a file name, or a combination. Wildcards can be used. destination Specifies where files are to be expanded. If source is multiple files and -r is not specified, destination must be a directory. Destination can consist of a drive letter and colon, a directory name, a file name, or a combination.

Fastopen Windows 2000 and the MS-DOS subsystem do not use this command. It is accepted only for compatibility with MS-DOS files.

Fc Compares two files and displays the differences between them. fc [/a] [/b] [/c] [/l] [/lbn] [/n] [/t] [/u] [/w] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2 fc /b [drive1:][path1]filename1 [drive2:][path2]filename2 Parameters /a Abbreviates the output of an ASCII comparison. Instead of displaying all the lines that are different, fc displays only the first and last line for each set of differences. /b

Page 34: W2K Cmd Line

Windows 2000 Command Line

Page 34 of 101

Compares the files in binary mode. Fc compares the two files byte by byte and does not attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files that have extensions of .exe, .com, .sys, .obj, .lib, or .bin. /c Ignores the case of letters. /l Compares the files in ASCII mode. Fc compares the two files line by line and attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files that do not have extensions of .exe, .com, .sys, .obj, .lib, or .bin. /lbn Sets the number of lines for the internal line buffer. The default length of the line buffer is 100 lines. If the files being compared have more than this number of consecutive differing lines, fc cancels the comparison. /n Displays the line numbers during an ASCII comparison. /t Does not expand tabs to spaces. The default behavior is to treat tabs as spaces, with stops at each eighth character position. /u Compares files as Unicode text files. /w Compresses white space (tabs and spaces) during the comparison. If a line contains many consecutive spaces or tabs, the /w switch treats these characters as a single space. When used with the /w switch, fc ignores (and does not compare) white space at the beginning and end of a line. /nnnn Specifies the number of consecutive lines that must match before fc considers the files to be resynchronized. If the number of matching lines in the files is less than this number, fc displays the matching lines as differences. The default value is 2. [drive1:][path1]filename1 Specifies the location and name of the first file you want to compare. [drive2:][path2]filename2 Specifies the location and name of the second file you want to compare.

Fcbs Specifies the number of file control blocks (FCBs) that the MS-DOS subsystem can have open at the same time. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to specify the number of FCBs. A file control block is a data structure that stores information about a file. fcbs=x Parameter x Specifies the number of FCBs that the MS-DOS subsystem can have open at one time. Valid values for x are in the range 1 through 255. The default value is 4.

Files Sets the number of files that the MS-DOS subsystem can access at one time. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to specify the files parameter. files=x Parameter x Specifies the number of files that the MS-DOS subsystem can access at one time. Valid values for x are in the range 8 through 255. The default value is 8.

Filter commands Filter commands help you sort, view, and select parts of a command's output. Passing information through filter commands Filter commands divide, rearrange, or extract portions of the information that passes through them. Windows 2000 has three filter commands:

• The more command displays the contents of a file or the output of a command one screen at a time. • The find command searches through files and command output for the characters you specify. • The sort command alphabetizes files and command output.

To send input from a file to a filter command, use the less-than sign (<). If you want the filter command to get its input from another command, use the pipe (|). Controlling the Screen Display by Using the More Command The more command displays the contents of a file or the output of a command one screen at a time. For example, the following more command displays the contents of the List.txt file one screen at a time:

more < list.txt After a screen of information is displayed, the word "More" appears. To continue to the next screen, press any key on the keyboard. To stop the command without viewing more information, press CTRL+C.

Page 35: W2K Cmd Line

Windows 2000 Command Line

Page 35 of 101

The more command is helpful if you are working with a command that produces more than one screen of output. For example, suppose you want to view a tree for your hard disk. If you have more directories than Windows 2000 can display on the screen, you can use the tree command with a pipe (|) and a more command, as in the following example:

tree c:\ | more The first screen of output from the tree command is displayed, followed by the word "More." Windows 2000 pauses until you press any key on the keyboard (except PAUSE). Searching for text by using the find command The find command searches one or more files for the text you specify. Windows 2000 displays every line containing that text. The find command can be used as a filter command or as a standard Windows 2000 command. For information about using find as a standard Windows 2000 command, click find in the list. To use find as a filter command, include a less-than sign (<) and a file name to search through. Keep in mind that the search is case sensitive when entering a file name. For example, the following command finds occurrences of the string "Pacific Rim" in the file Trade.txt:

find "Pacific Rim" < trade.txt To save the output of the find command rather than display it, use a greater-than sign (>) and the name of the file that is to store the output. For example, the following command finds occurrences of "Pacific Rim" in the Trade.txt file and saves them in the Nwtrade.txt file:

find "Pacific Rim" < trade.txt > nwtrade.txt Sorting text files The sort command alphabetizes a text file or the output of a command. For example, you would use the following command to sort the contents of a file named List.txt and display the results on your screen:

sort < list.txt In this example, the sort command sorts the lines of the List.txt file and displays the results without changing the file. To save the output of the sort command rather than display it, include a greater-than sign (>) and a file name in the command. For example, you would use the following command to alphabetize the lines of the List.txt file and store the results in the Alphlist.txt file:

sort < list.txt > alphlist.txt To sort the output of a command, type the command followed by a pipe (|) and the sort command. For example, the following command sorts the output of the find command:

find "Jones" maillst.txt | sort When you type this command, Windows 2000 lists in alphabetic order the lines in which the string "Jones" appears. Combining commands with redirection characters You can combine filter commands, other commands, and file names to make custom commands. For example, you could use the following command to store the names of files that contain the string "LOG":

dir /b | find "LOG" > loglist.txt Windows 2000 sends the output of the dir command through the find filter command and stores the file names that contain the string "Log" in the Loglist.txt file. The results are stored as a list of file names (for example, A.log, Logdat.svd, and Mylog.bat). To use more than one filter in the same command, separate the filters with a pipe (|). For example, the following command searches every directory on drive C, finds the file names that include the string "Log", and displays them one screen at a time:

dir c:\ /s /b | find "LOG" | more Because you use a pipe (|), Windows 2000 sends the output of the dir command through the find command. The find command selects only file names that contain the string "Log." The more command displays the file names that are selected by the find command, one screen at a time.

Find Searches for a specific string of text in a file or files. After searching the specified files, find displays any lines of text that contain the specified string. find [/v] [/c] [/n] [/i] "string" [[drive:][path]filename[...]] Parameters /v Displays all lines not containing the specified string. /c Displays only a count of the lines that contain the specified string. /n Precedes each line with the file's line number. /i Specifies that the search is not to be case sensitive. "string" Specifies the group of characters you want to search for. You must enclose the text for string in quotation marks. [drive:][path] filename Specifies the location and name of the file in which to search for the specified string.

Page 36: W2K Cmd Line

Windows 2000 Command Line

Page 36 of 101

Findstr Searches for strings in files using literal text or regular expressions. Click Devinfo Notes in the list for a list of the regular expression symbols accepted by findstr. findstr [/b] [/e] [/l] [/c:string] [/r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/g:file] [/f:file] [/d:dirlist] [/a:color attribute] [strings] [[drive:][path] filename [...]] Parameters /b Matches the pattern if at the beginning of a line. /e Matches the pattern if at the end of a line. /l Uses search strings literally. /c: string Uses specified text as a literal search string. /r Uses search strings as regular expressions. This switch is not required; findstr interprets all metacharacters as regular expressions unless the /l switch is used. /s Searches for matching files in the current directory and all subdirectories. /i Specifies that the search is not to be case sensitive. /x Prints lines that match exactly. /v Prints only lines that do not contain a match. /n Prints the line number before each line that matches. /m Prints only the file name if a file contains a match. /o Prints seek offset before each matching line. /g file Gets search strings from the specified file. /f file Reads file list from the specified file. /d dirlist Searches a comma-delimited list of directories. /a color attribute Specifies color attributes with two hexadecimal digits. Use spaces to separate multiple search strings unless the argument is prefixed with /c, as shown in the following example:

findstr "hello there" x.y

searches for "hello" or "there" in file x.y. However, the following command searches for "hello there" in file x.y.

findstr /c:"hello there" x.y

Finger Displays information about a user on a specified system running the Finger service. Output varies based on the remote system. This command is available only if the TCP/IP protocol has been installed. finger [-l] [user]@computer [...] Parameters -l Displays information in long list format. user Specifies the user you want information about. Omit the user parameter to display information about all users on the specified computer: @computer

Page 37: W2K Cmd Line

Windows 2000 Command Line

Page 37 of 101

For Runs a specified command for each file in a set of files. You can use the for command within a batch program or directly from the command prompt. To use for in a batch program, use the following syntax: for %%variable in (set) do command [command-parameters] To use for from the command prompt, use the following syntax: for %variable in (set) do command [command-parameters] Parameters %%variable or %variable Represents a replaceable parameter. The for command replaces %%variable (or %variable) with each text string in the specified set until the command (specified in the command-parameters) processes all of the files. Use %%variable to carry out the for command within a batch program. Use %variable to carry out for from the command prompt. Variable names are case sensitive. (set) Specifies one or more files or text strings that you want to process with the specified command. The parentheses are required. command Specifies the command that you want to carry out on each file included in the specified set. command-parameters Specifies any parameters or switches that you want to use with the specified command (if the specified command uses any parameters or switches). If command extensions are enabled (the default setting in Windows 2000), additional forms of the for command are supported.

Forcedos Starts the specified program in the MS-DOS subsystem. This command is necessary only for those MS-DOS programs not recognized as such by Windows 2000. forcedos [/d directory] filename [parameters] Parameters /d directory Specifies the current directory for the specified program to use. filename Specifies the program to start. If not in the current directory or Windows 2000 path, you must specify the drive letter or directories to the program. parameters Specifies parameters to pass to the program.

Page 38: W2K Cmd Line

Windows 2000 Command Line

Page 38 of 101

Format Formats the disk in the specified volume to accept Windows 2000 files. You must be a member of the Administrators group to format a hard drive. format volume [/fs:file-system] [/v:label] [/q] [/a:unitsize] [/f:size] [/t:tracks /n:sectors] [/c] [/x] [/1] [/4] [/8] Parameters volume: Specifies the mount point, volume name, or drive letter of the drive you want to format. If you do not specify any of the following switches, format uses the volume type to determine the default format for the disk. /fs:file-system Specifies the file system to use, FAT, FAT32, or NTFS. Floppy disks can use only the FAT file system. /v:label Specifies the volume label. If you omit the /v switch, or use it without specifying a volume label, Windows 2000 prompts you for the volume label after the formatting is completed. Use the syntax /v: to prevent the prompt for a volume label. If you format more than one disk by using one format command, all of the disks will be given the same volume label. The /v switch is not compatible with the /8 switch. For more information about disk volume labels, click Dir, Label, and Vol in the list. /a:unitsize Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. Use one of the following values for unitsize. If unitsize is not specified, it will be chosen based on volume size.

512 Creates 512 bytes per cluster. 1024 Creates 1024 bytes per cluster. 2048 Creates 2048 bytes per cluster. 4096 Creates 4096 bytes per cluster. 8192 Creates 8192 bytes per cluster. 16K Creates 16 kilobytes per cluster. 32K Creates 32 kilobytes per cluster. 64K Creates 64 kilobytes per cluster. /q Deletes the file table and the root directory of a previously formatted volume, but does not scan for bad areas. You should use the /q switch to format only previously formatted volumes that you know are in good condition. /f:size Specifies the size of the floppy disk to format. When possible, use this switch instead of the /t and /n switches. Use one of the following values for size: 160 or 160k or 160kb 160KB, single-sided, double-density, 5.25-inch disk 180 or 180k or 180kb 180KB, single-sided, double-density, 5.25-inch disk 320 or 320k or 320kb 320KB, double-sided, double-density, 5.25-inch disk 360 or 360k or 360kb 360KB, double-sided, double-density, 5.25-inch disk 720 or 720k or 720kb 720KB, double-sided, double-density, 3.5-inch disk 1200 or 1200k or 1200kb or 1.2 or 1.2m or 1.2mb 1.2-MB, double-sided, quadruple-density, 5.25-inch disk 1440 or 1440k or 1440kb or 1.44 or 1.44m or 1.44mb 1.44-MB, double-sided, quadruple-density, 3.5-inch disk 2880 or 2880k or 2880kb or 2.88 or 2.88m or 2.88mb 2.88-MB, double-sided, 3.5-inch disk 20.8 or 20.8m or 20.8mb 20.8-MB, 3.5-inch floptical (magneto-optical) disk /t:tracks Specifies the number of tracks on the disk. When possible, use the /f switch instead of this switch. If you use the /t switch, you must also use the /n switch. These two switches provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f switch with the /t switch. /n:sectors

Page 39: W2K Cmd Line

Windows 2000 Command Line

Page 39 of 101

Specifies the number of sectors per track. When possible, use the /f switch instead of this switch. If you use the /n switch, you must also use the /t switch. These two switches provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f switch with the /n switch. /c Files created on the new volume will be compressed by default. /x Causes the volume to dismount, if necessary, before it is formatted. Any open handles to the volume will no longer be valid. /1 Formats a single side of a floppy disk. /4 Formats a 5.25-inch, 360KB, double-sided, double-density floppy disk on a 1.2-MB disk drive. Some 360KB drives cannot reliably read disks formatted with this switch. When used with the /1 switch, this switch formats a 5.25-inch, 180KB, single-sided floppy disk. /8 Formats a 5.25-inch disk with 8 sectors per track. This switch formats a floppy disk to be compatible with MS-DOS versions prior to 2.0.

Ftp Transfers files to and from a computer running an FTP server service (sometimes called a daemon). Ftp can be used interactively. Click ftp commands in the list for a description of available ftp subcommands. This command is available only if the TCP/IP protocol has been installed. Ftp is a service, that, once started, creates a sub-environment in which you can use ftp commands, and from which you can return to the Windows 2000 command prompt by typing the quit subcommand. When the ftp sub-environment is running, it is indicated by the ftp command prompt. ftp [-v] [-n] [-i] [-d] [-g] [-s:filename] [-a] [-w:windowsize] [computer] Parameters -v Suppresses display of remote server responses. -n Suppresses autologin upon initial connection. -i Turns off interactive prompting during multiple file transfers. -d Enables debugging, displaying all ftp commands passed between the client and server. -g Disables file name globbing, which permits the use of wildcard characters (* and ?) in local file and path names. (See the glob command in the online Command Reference.) -s:filename Specifies a text file containing ftp commands; the commands automatically run after ftp starts. No spaces are allowed in this parameter. Use this switch instead of redirection (>). -a Use any local interface when binding data connection. -w:windowsize Overrides the default transfer buffer size of 4096. computer Specifies the computer name or IP address of the remote computer to connect to. The computer, if specified, must be the last parameter on the line.

Ftp commands Select an ftp command to get more information.

Ftp: ! Ftp: glob Ftp: put Ftp: ? Ftp: hash Ftp: pwd Ftp: append Ftp: help Ftp: quit Ftp: ascii Ftp: lcd Ftp: quote Ftp: bell Ftp: literal Ftp: recv Ftp: binary Ftp: ls Ftp: remotehelp Ftp: bye Ftp: mdelete Ftp: rename Ftp: cd Ftp: mdir Ftp: rmdir Ftp: close Ftp: mget Ftp: send Ftp: debug Ftp: mkdir Ftp: status Ftp: delete Ftp: mls Ftp: trace Ftp: dir Ftp: mput Ftp: type Ftp: disconnect Ftp: open Ftp: user Ftp: get Ftp: prompt Ftp: verbose

Page 40: W2K Cmd Line

Windows 2000 Command Line

Page 40 of 101

Ftype Displays or modifies file types used in file name extension associations. Ftype [filetype[=[command]]] Parameters filetype Specifies the file type you want to display or change. command Specifies the open command to use when opening files of this type. Type ftype without options to display the current file types that have open command strings defined. Type ftype filetype to display the current open command string for this file type. Type ftype filetype= to delete the open command string for the file type. Within an open command string, ftype substitutes the following variables: %0 or %1 are substituted with the file name being opened. %* is substituted with all the parameters %~n is substituted with all the remaining parameters, starting with the nth parameter, where n can be any number from 2 to 9. %3 is substituted with the first parameter, %4 with the second, and so on.

Goto Directs Windows 2000 to a line in a batch program marked by a label you specify. The goto command directs Windows 2000 within a batch program to a line identified by a label. When Windows 2000 finds the label, it processes the commands beginning on the next line. goto label Parameter label Specifies the line in a batch program to which Windows 2000 should go. If command extensions are enabled (the default setting in Windows 2000), goto changes as follows: Using the goto command with a target label of :EOF transfers control to the end of the current batch script file, exiting the batch script file without defining a label. When using goto with the :EOF label, you must insert a colon before the label, for example:

goto :EOF For a description of extensions to the call command that make this feature useful, or for a discussion of enabling command extensions, click cmd in the list.

Graftabl Enables Windows 2000 to display the extended characters of a specified code page in full screen mode. Extended characters are not displayed window mode. graftabl [xxx] [/status] Parameters xxx Specifies the code page for which you want Windows 2000 to define the appearance of extended characters in graphics mode. The following list shows each valid code page identification number and its Country/Region or language: 437 United States 850 Multilingual (Latin I) 852 Slavic (Latin II) 855 Cyrillic (Russian) 857 Turkish 860 Portuguese 861 Icelandic 863 Canadian-French 865 Nordic 866 Russian 869 Modern Greek /status Identifies the code page selected for use by graftabl. For information about using code pages, click chcp or mode (set device code pages) in the list.

Graphics Loads a program into memory that allows Windows 2000 to print on a printer the displayed contents of the screen when you are using a color or graphics adapter. graphics [type] [[drive:][path] filename] [/r] [/b] [/lcd] [/printbox:std | /printbox:lcd] Parameters type Specifies the type of printer. The following list shows each valid value for this parameter and a brief description of its meaning:

Page 41: W2K Cmd Line

Windows 2000 Command Line

Page 41 of 101

Parameter Description color1 An IBM Personal Computer Color printer with black ribbon color4 An IBM Personal Computer Color printer with RGB (red, green, blue, and black) ribbon color8 An IBM Personal Computer Color printer with CMY (cyan, magenta, yellow, and black) ribbon

hpdefault Any Hewlett-Packard PCL printer deskjet A Hewlett-Packard DeskJet printer graphics An IBM Personal Graphics printer, IBM Proprinter, or IBM Quietwriter printer graphicswide An IBM Personal Graphics printer with an 11-inch wide carriage laserjet A Hewlett-Packard LaserJet printer laserjetii A Hewlett-Packard LaserJet II printer paintjet A Hewlett-Packard PaintJet printer quietjet A Hewlett-Packard QuietJet printer quietjetplu A Hewlett-Packard QuietJet Plus printer ruggedwriter A Hewlett-Packard RuggedWriter printer ruggedwriterwide A Hewlett-Packard RuggedWriterwide printer thermal An IBM PC convertible Thermal Printer thinkjet A Hewlett-Packard ThinkJet printer [drive:][path] filename Specifies the location and name of the printer profile that contains information about all supported printers. If this parameter is omitted, Windows 2000 looks for a file called Graphics.pro in the current directory and in the directory that contains the Graphics.com file. /r Prints the image as it appears on the screen (white characters on a black background) rather than reversed (black characters on a white background). The latter occurs by default. /b Prints the background in color. This switch is valid for color4 and color8 printers. /lcd Prints an image by using the liquid crystal display (LCD) aspect ratio instead of the CGA aspect ratio. The effect of this switch is the same as that of /printbox:lcd. /printbox:std | /printbox:lcd Selects the printbox size. You can abbreviate printbox as pb. You should check the first operand of the printbox statement in your Graphics.pro file and specify the /printbox:std switch if that operand is std or the /printbox:lcd switch if that operand is lcd.

Help Provides online information about Windows 2000 commands (non-network). help [command] Parameter command Specifies the name of the command about which you want information. If you do not specify a command name, the help command lists and briefly describes every Windows 2000 system command.

Note

There are two ways to get online Help for a command. You can specify the name of the command on the help command line, 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 xcopy command:

help xcopy xcopy /?

The second command is slightly faster.

Click net help in the list for information about help with network commands.

Page 42: W2K Cmd Line

Windows 2000 Command Line

Page 42 of 101

Hostname Prints the name of the current computer (host). This command is available only if the TCP/IP protocol has been installed. hostname

If Performs conditional processing in batch programs. If the condition specified in an if command is true, Windows 2000 carries out the command that follows the condition. If the condition is false, Windows 2000 ignores the command in the if clause, and executes any command in the else clause, if one has been specified. if [not] errorlevel number command [else expression] if [not] string1==string2 command [else expression] if [not] exist filename command [else expression] With command extensions enabled: if [/i] string1 compare-op string2 command [else expression] if cmdextversion number command [else expression] if defined variable command [else expression] Parameters not Specifies that Windows 2000 should carry out the command only if the condition is false. errorlevel number Specifies a true condition only if the previous program run by Cmd.exe returned an exit code equal to or greater than number. command Specifies the command that Windows 2000 should carry out if the preceding condition is met. string1==string2 Specifies a true condition only if string1 and string2 are the same. These values can be literal strings or batch variables (%1, for example). Literal strings do not need quotation marks. exist filename Specifies a true condition if filename exists. compare-op one of the following three-letter comparison operators:

Operator Description EQU equal to NEQ not equal to LSS less than LEQ less than or equal to GTR greater than GEQ greater than or equal to /i The /i switch, when specified, forces string comparisons to ignore case. The /i switch can also be used on the string1==string2 form of if. These comparisons are generic, in that if both string1 and string2 are both comprised of all numeric digits, then the strings are converted to numbers and a numeric comparison is performed. cmdextversion number The cmdextversion conditional works just like errorlevel, except it is comparing against an internal version number associated with the Command Extensions feature of Cmd.exe. The first version is 1. It will be incremented by one when significant enhancements are added to the command extensions. The cmdextversion conditional is never true when command cxtensions are disabled. defined variable The defined conditional works just like exist except it takes an environment variable name and returns true if the environment variable is defined. Three variables are added with this conditional: %errorlevel%, %cmdcmdline%, and %cmdextversion%. %errorlevel% expands into a string representation of the current value of errorlevel, provided that there is not already an environment variable with the name ERRORLEVEL, in which case you will get its value instead. After running a program, the following illustrates errorlevel use:

goto answer%erorlevel%

:answer0

echo Program had return code 0

:answer1

echo Program had return code 1 You can also use the comparison operators listed above at compare-op:

if %errorlevel% LEQ 1 goto okay %cmdcmdline% expands into the original command line passed to Cmd.exe prior to any processing by Cmd.exe, provided that there is not already an environment variable with the name cmdcmdline , in which case you will get its value instead.

Page 43: W2K Cmd Line

Windows 2000 Command Line

Page 43 of 101

%cmdextversion% expands into the a string representation of the current value of cmdextversion, provided that there is not already an environment variable with the name CMDEXTVERSION, in which case you will get its value instead. expression In an else clause, an expression consists of a Windows 2000 command and any parameters to be passed to the command.

Install Loads a memory-resident program into memory. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to specify the program to install. install=[drive:][path] filename [command-parameters] Parameters [drive:][path] filename Specifies the location and name of the memory-resident program you want to run. command-parameters Specifies parameters for the program you specify for filename.

Ipconfig This diagnostic command displays all current TCP/IP network configuration values. This command is of particular use on systems running DHCP, allowing users to determine which TCP/IP configuration values have been configured by DHCP. ipconfig [/all | /renew [adapter] | /release [adapter]] Parameters all Produces a full display. Without this switch, ipconfig displays only the IP address, subnet mask, and default gateway values for each network card. /renew [adapter] Renews DHCP configuration parameters. This option is available only on systems running the DHCP Client service. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. /release [adapter] Releases the current DHCP configuration. This option disables TCP/IP on the local system and is available only on DHCP clients. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters. With no parameters, the ipconfig utility presents all of the current TCP/IP configuration values to the user, including IP address and subnet mask. This utility is especially useful on systems running DHCP, allowing users to determine which values have been configured by DHCP.

Ipxroute Displays and modifies information about the routing tables used by the IPX protocol. The command has different options for IPX routing and for source routing. Separate all options with spaces.

IPX Routing Options

ipxroute servers [/type=x] ipxroute stats [/show] [/clear] ipxroute table Parameters servers [/type=x] Displays the Service Access Point (SAP) table for the specified server type. x must be an integer. For example, /type=4 displays all file servers. If no /type is specified, then servers of all types are shown. The list is sorted by server name. stats [/show] [/clear] Displays or clears IPX router interface statistics. /show is the default. /clear clears the statistics. table Displays the IPX routing table, sorted by network number.

Source Routing Options

ipxroute board=n [clear] [def] [gbr] [mbr] [remove=xxxxx] ipxroute config Parameters board=n Specifies the network adapter for which to query or set parameters. clear Clears the source routing table def Sends packets to the ALL ROUTES broadcast. If a packet is transmitted to a unique mac address that is not in the source routing table, the default is to send the packet to the SINGLE ROUTES broadcast. gbr Sends packets to the ALL ROUTES broadcast. If a packet is transmitted to the broadcast address (FFFFFFFFFFFF), the default is to send the packet to the SINGLE ROUTES broadcast.

Page 44: W2K Cmd Line

Windows 2000 Command Line

Page 44 of 101

mbr Sends packets to the ALL ROUTES broadcast. If a packet is transmitted to a multicast address (C000xxxxxxxx), the default is to send the packet to the SINGLE ROUTES broadcast. remove=xxxxx Removes the given node address from the source routing table. config Displays information on all the bindings for which IPX is configured.

Irftp Sends files over an infrared link (requires an infrared device on the computer). irftp [/h] [[drive:][path]filename [morefiles]] irftp /s /h Specifies hidden mode, which transmits the source files over the infrared link without displaying the Wireless Link dialog box. [[drive:][path]filename [morefiles] The locations and names of the files you want to transmit over an infrared connection. If you do not specify a file, then the Wireless Link open files dialog box opens enabling you to select the files you want to send over the link. /s Opens the properties for Wireless Link.

Label Creates, changes, or deletes the volume label (name) of a disk. Windows 2000 displays the volume label as part of the directory listing. If a volume serial number exists, Windows 2000 displays this number as well. label [drive:][label] Parameters none Type label without parameters to change the current volume label or delete the existing label. drive: Specifies the location of the disk you want to name. label Specifies the new volume label. You must include a colon (:) between drive and label.

Lastdrive Windows 2000 and the MS-DOS subsystem do not take action for this command. It is accepted only for compatibility with MS-DOS. Drives are always set to the maximum (Z).

Libpath Specifies the directories the OS/2 subsystem is to search for dynamic-link libraries (DLLs). To use this command, use an OS/2 editor to edit the C:\CONFIG.SYS file. libpath=[drive:]path[;[drive:]path][...] Parameters drive: Specifies the drive where DLLs are located. If you do not specify a drive, the OS/2 subsystem searches the disk in the current drive. path Specifies the directory to search for DLLs. You can specify more than one directory, separating the names with semicolons (;).

Loadfix Ensures that a program is loaded above the first 64KB of conventional memory, and runs the program. loadfix [drive:][path] filename [drive:][path] Specifies the drive and directory of the program. filename Specifies the name of the program.

Loadhigh (Lh) Loads a program into the upper memory area (UMA). Loading a program into the UMA leaves more room in conventional memory for other programs. Use the systemroot\System32\Config.nt file, or the equivalent startup file specified in a program's PIF, to specify the programs to load high. loadhigh [drive:][path] filename [parameters]

Page 45: W2K Cmd Line

Windows 2000 Command Line

Page 45 of 101

lh [drive:][path] filename [parameters] Parameters [drive:][path] filename Specifies the location and name of the program you want to load. parameters Specifies any command line information required by the program.

Lpq This diagnostic utility is used to obtain status of a print queue on a computer running the LPD server. lpq -SServer -PPrinter [-l] Parameters -SServer Specifies the name of the computer that has the printer attached to it. -PPrinter Specifies the name of the printer for the desired queue. -l Specifies that a detailed status should be given.

Lpr This connectivity utility is used to print a file to a computer running an LPD server. lpr -SServer -PPrinter [-CClass] [-JJobname] [-O option] filename Parameters -SServer Specifies the name or IP address of the computer that has the printer attached to it. -PPrinter Specifies the name of the printer for the desired queue. -CClass Specifies the content of the banner page for the class. -JJobname Specifies the name of this job. -O option Indicates the type of file. The default is a text file. Use -Ol (lowercase 'L') for a binary file (for example, PostScript). filename The name of the file to be printed.

Mem Displays information about allocated memory areas, free memory areas, and programs that are currently loaded into memory in the MS-DOS subsystem. mem [/program|/debug|/classify] Parameters none Type mem without parameters to display the status of the MS-DOS subsystem's used and free memory. /program Displays the status of programs that are currently loaded into memory. You cannot use the /program switch with the /debug switch or the /classify switch. You can abbreviate /program as /p. /debug Displays the status of currently loaded programs and of internal drivers, and displays other programming information. You cannot use the /debug switch with the /program switch or the /classify switch. You can abbreviate /debug as /d. /classify Displays the status of programs loaded into conventional memory and the upper memory area. This switch lists the size of each program in decimal and hexadecimal notation, provides a summary of memory use, and lists the largest memory blocks that are available. You cannot use the /classify switch with the /program switch or the /debug switch. You can abbreviate /classify as /c.

Mkdir (md) Creates a directory or subdirectory. mkdir [drive:]path 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. The maximum length of any single path is determined by the file system.

Mode

Page 46: W2K Cmd Line

Windows 2000 Command Line

Page 46 of 101

Configures system devices. The mode command performs many different tasks, such as displaying system status, changing system settings, or reconfiguring ports or devices. Using the mode command Because the mode command can perform many different tasks, the syntax necessary to carry out each task is different. Therefore, this reference discusses the tasks separately. The following is a list of tasks for which you can use the mode command. Reconfigure a printer attached to a parallel port (PRN, LPT1, LPT2, or LPT3) for printing at 80 or 132 characters per line, 6 or 8 lines per inch, or both (if the printer supports these features). Configure the baud rate, parity, and number of data bits and stop bits of a serial communications port (COM1, COM2, COM3, and COM4) for use with a specific printer, modem, or other serial device.

• Display the status of all devices or of a single device. • Redirect printer output from a parallel port to a serial port so that the serial port becomes the system's default

printer port. • Change the size of the command prompt window. • Set the keyboard's typematic rate.

Select, refresh, or display the numbers of the code pages in the console.

More Displays one screen of output at a time. This command is commonly used to view long files. You can use this command by iteself or use it to control the output of another command, such as the type command. When the display fills the available viewing area, the more prompt appears, and you can enter any one of a number of commands to control how you view the rest of the file. command name | more [/c] [/p] [/s] [/tn] [+n] more [[/c] [/p] [/s] [/tn] [+n]] < [drive:] [path] filename more [/c] [/p] [/s] [/tn] [+n] [files] Parameters [drive:] [path] filename Specifies the file to display. command name Specifies a command whose output will be displayed. /c Clears screen before displaying page. /p Expands form-feed characters. /s Changes multiple blank lines to one blank line. /tn Changes tabs to n spaces. +n Displays first file beginning at the line specified by n. files Specifies list of files to display. Separate file names with a space. More subcommands

The following commands are accepted at the more prompt (-- More --) .

Key Action space Display next page. ENTER Display next line. F Display next file. q Quit. ? Show available commands. = Show line number. P n Display next n lines. S n Skip next n lines. For more information, click Filter commands, Redirection symbols, Dir, or Type in the list.

Mountvol Creates, deletes, or lists a volume mount point. Mountvol is a way to link volume partitions without requiring a drive letter in Windows 2000. mountvol [drive:]path VolumeName mountvol [drive:]path /d mountvol [drive:]path /l

Page 47: W2K Cmd Line

Windows 2000 Command Line

Page 47 of 101

Parameters [drive:]path Specifies the existing NTFS directory folder where the mount point will reside. VolumeName Specifies the volume name that is the target of the mount point. If you do not specify a volume name, mountvol lists the volume names of all partitions. /d Removes the volume mount point from the specified folder. /l Lists the mounted volume name for the specified folder.

Move Moves one or more files from one directory to the specified directory. move [/y | /-y] [source] [target] Parameters /y Suppresses prompting to confirm you want to overwrite an existing destination file. The /y switch may be preset in the COPYCMD environment variable. This may be overridden with /-y on the command line. The default is to prompt on overwrites unless the copy command is being executed from within a batch script. /-y Causes prompting to confirm you want to overwrite an existing destination file. source Specifies the path and name of the file or files to move. If you want to move or rename a directory, source should be the current directory path and name. target Specifies the path and name to move files to. If you want to move or rename a directory, target should be the desired directory path and name.

MS-DOS configuration commands Select a command to get more information.

buffers fcbs country files device install devicehigh (dh) lastdrive dos ntcmdprompt dosonly shell driveparm stacks echoconfig switches You configure the MS-DOS subsystem with configuration commands, such as device or lastdrive. Place these commands in the Config.nt file in the systemroot\System32 directory or in the Config file specified by an application's PIF. These commands affect only the MS-DOS subsystem. Many of them, such as buffers and break, are ignored because the MS-DOS subsystem works without them. They are accepted for compatibility only.

MS-DOS subsystem commands Select a command to get more information.

append graphics debug loadfix debug commands loadhigh (lh)

edit mem edlin nlsfunc edlin commands qbasic exe2bin setver expand share fastopen Windows 2000 includes 16-bit commands (nonnative) for the MS-DOS subsystem and other subsystems. These include older commands, such as edlin or graphics, and MS-DOS-specific commands, such as debug or exe2bin. These 16-bit commands are included to maintain MS-DOS and MS OS/2 version 1.x compatibility.

Page 48: W2K Cmd Line

Windows 2000 Command Line

Page 48 of 101

Other MS-DOS subsystem commands, such as share, perform functions that are now inherent to Windows 2000 or the MS-DOS subsystem. The commands are accepted to preserve compatibility with existing files, but the commands have no effect because the functionality is automatic in Windows 2000.

Nbtstat This diagnostic command displays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP). This command is available only if the TCP/IP protocol has been installed. nbtstat [-a remotename] [-A IP address] [-c] [-n] [-R] [-r] [-S] [-s] [interval] Parameters -a remotename Lists the remote computer's name table using its name. -A IP address Lists the remote computer's name table using its IP address. -c Lists the contents of the NetBIOS name cache giving the IP address of each name. -n Lists local NetBIOS names. Registered indicates that the name is registered by broadcast (Bnode) or WINS (other node types). -R Reloads the Lmhosts file after purging all names from the NetBIOS name cache. -r Lists name resolution statistics for Windows networking name resolution. On a Windows 2000 computer configured to use WINS, this option returns the number of names resolved and registered via broadcast or via WINS. -S Displays both client and server sessions, listing the remote computers by IP address only. -s Displays both client and server sessions. It attempts to convert the remote computer IP address to a name using the Hosts file. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If this parameter is omitted, nbtstat prints the current configuration information once.

Net (command options) Many Windows 2000 networking commands begin with the word net. These net commands have some common properties:

• You can see a list of all available net commands by typing net /?. • You can get syntax help at the command line for a net command by typing net help command. For example, for

help with the net accounts command, type net help accounts. • All net commands accept /yes and /no options (can be abbreviated /y and /n). The /y option automatically

answers yes to any interactive prompt that the command generates, while /n answers no. For example, net stop server usually prompts you to confirm that you want to stop all services that depend on the Server service, while net stop server /y automatically answers yes to the prompt and the Server service shuts down.

Net accounts Updates the user accounts database and modifies password and logon requirements for all accounts. The Net Logon service must be running on the computer for which you want to change account parameters.

net accounts [/forcelogoff:{minutes | no}] [/minpwlen:length] [/maxpwage:{days | unlimited}] [/minpwage:days] [/uniquepw:number] [/domain]

net accounts [/sync] [/domain]

Parameters

none

Type net accounts without parameters to display the current settings for password, logon limitations, and domain information.

/forcelogoff:{minutes | no}

Sets the number of minutes to wait before ending a user's session with a server when the user account or valid logon time expires. The no option prevents forced logoff. The default is no.

When the /forcelogoff:minutes option is specified, Windows 2000 sends a warning minutes before it forces the user off from the network. If any files are open, Windows 2000 warns the user. If minutes is less than two, Windows 2000 warns the user to log off from the network immediately.

/minpwlen:length

Sets the minimum number of characters for a user account password. The range is 0-127 characters, and the default is 6 characters.

Page 49: W2K Cmd Line

Windows 2000 Command Line

Page 49 of 101

/maxpwage:{days | unlimited}

Sets the maximum number of days that a user account's password is valid. A value of unlimited sets no maximum time. The /maxpwage option must be greater than /minpwage. The range is 1-49,710 days (unlimited), and the default is 90 days.

/minpwage:days

Sets the minimum number of days before a user can change a new password. A value of 0 sets no minimum time. The range is 0-49,710 days, and the default is 0 days.

/uniquepw:number

Requires that a user not repeat the same password for number password changes. The range is 0-24 password changes, and the default is 5 password changes.

/domain

Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer.

This parameter applies only to Windows 2000 Workstation computers that are members of a Windows 2000 Server domain. By default, Windows 2000 Server computers perform operations on the primary domain controller.

/sync

When used on the primary domain controller, causes all backup domain controllers in the domain to synchronize. When used on a backup domain controller, causes that backup domain controller only to synchronize with the primary domain controller. This command applies only to computers that are members of a Windows 2000 Server domain.

Net computer Adds or deletes computers from a domain database. This command is available only on computers running Windows 2000 Server.

net computer \\computername {/add | /del}

Parameters

\\computername

Specifies the computer to add or delete from the domain.

/add

Adds the specified computer to the domain.

/del

Removes the specified computer from the domain.

Net config Displays the configurable services that are running, or displays and changes settings for a service.

net config [service [options]]

Parameters

none

Type net config without parameters to display a list of configurable services.

service

Specifies a service (server or workstation) that can be configured with the net config command.

options

Are specific to the service. Click net config server or net config workstation in the list for more information on the complete syntax.

Net config server Displays or changes settings for the Server service while the service is running.

net config server [/autodisconnect:time] [/srvcomment:"text "] [/hidden:{yes | no}]

Parameters

none

Type net config server to display the current configuration for the Server service.

/autodisconnect:time

Page 50: W2K Cmd Line

Windows 2000 Command Line

Page 50 of 101

Sets the maximum number of minutes a user's session can be inactive before it is disconnected. You can specify -1 to never disconnect. The range extends from -1 to 65535 minutes, and the default is 15.

/srvcomment:"text "

Adds a comment for the server that is displayed in Windows 2000 screens and with the net view command. The comment can have as many as 48 characters. Enclose the text in quotation marks.

/hidden:{yes | no}

Specifies whether the computer name of the server appears on display listings of servers. Note that hiding a server does not alter the permissions on that server. The default is no.

Net config workstation Displays or changes settings for the Workstation service while the service is running.

net config workstation [/charcount:bytes] [/chartime:msec] [/charwait:sec]

Parameters

none

Type net config workstation to display the current configuration for the local computer.

/charcount:bytes

Specifies the amount of data Windows 2000 collects before sending the data to a communication device. If /chartime:msec is also set, Windows 2000 acts on whichever option is satisfied first. The range extends from 0 to -65535 bytes, and the default is 16 bytes.

/chartime:msec

Sets the number of milliseconds Windows 2000 collects data before sending the data to a communication device. If /charcount:bytes is also set, Windows 2000 acts on whichever option is satisfied first. The range extends from 0 to 65535000 milliseconds, and the default is 250 milliseconds.

/charwait:sec

Sets the number of seconds Windows 2000 waits for a communication device to become available. The range extends from 0 to 65535 seconds, and the default is 3600 seconds.

Net continue Reactivates suspended services.

net continue service

Parameters

service

Services that can be continued are: file server for macintosh (Windows 2000 Server only), ftp publishing service, lpdsvc, net logon, network dde, network dde dsdm, nt lm security support provider, remote access server, schedule, server, simple tcp/ip services, and workstation.

Net file Displays the names of all open shared files on a server and the number of file locks, if any, on each file. This command also closes individual shared files and removes file locks.

net file [id [/close]]

Parameters

none

Type net file without parameters to get a list of the open files on a server.

id

Specifies the identification number of the file.

/close

Closes an open file and releases locked records. Type this command from the server where the file is shared.

Page 51: W2K Cmd Line

Windows 2000 Command Line

Page 51 of 101

Net group Adds, displays, or modifies global groups on Windows 2000 Server domains. This command is available for use only on Windows 2000 Server Domain Controllers.

net group [groupname [/comment:"text"]] [/domain]

net group groupname {/add [/comment:"text"] | /delete} [/domain]

net group groupname username[ ...] {/add | /delete} [/domain]

Parameters

none

Type net group without parameters to display the name of a server and the names of groups on the server.

groupname

Specifies the name of the group to add, expand, or delete. Supply only a group name to view a list of users in a group.

/comment:"text"

Adds a comment for a new or existing group. The comment can have as many as 48 characters. Enclose the text in quotation marks.

/domain

Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer.

This parameter applies only to Windows 2000 Professional computers that are members of a Windows 2000 Server domain. By default, Windows 2000 Server computers perform operations on the primary domain controller.

username[ ...]

Lists one or more user names to add to or remove from a group. Separate multiple user name entries with a space.

/add

Adds a group, or adds a user name to a group. An account must be established for users added to a group with this command.

/delete

Removes a group, or removes a user name from a group.

Net help Provides a list of network commands and topics you can get help with, or provides help with a specific command or topic. The available net commands are also listed in the Commands window of the Command Reference under N. Click Windows 2000 Command Reference in the list.

net help [command]

net command {/help | /?}

Parameters

none

Type net help without parameters to display a list of commands and topics for which you can get help.

command

Is the command you need help with. Don't type net as part of command.

{/help | /?}

Displays the correct syntax for the command. /help provides an alternate way to display the help text.

Net helpmsg Provides help with Windows 2000 error messages.

net helpmsg message#

Parameter

message#

Specifies the four-digit number of the Windows 2000 message you need help with.

Page 52: W2K Cmd Line

Windows 2000 Command Line

Page 52 of 101

Net localgroup Adds, displays, or modifies local groups.

net localgroup [groupname [/comment:"text"]] [/domain]

net localgroup groupname {/add [/comment:"text"] | /delete} [/domain]

net localgroup groupname name [ ...] {/add | /delete} [/domain]

Parameters

none

Type net localgroup without parameters to display the name of the server and the names of local groups on the computer.

groupname

Specifies the name of the local group to add, expand, or delete. Supply only a groupname to view a list of users or global groups in a local group.

/comment:"text"

Adds a comment for a new or existing group. The comment can have as many as 48 characters. Enclose the text in quotation marks.

/domain

Performs the operation on the primary domain controller of the current domain. Otherwise, the operation is performed on the local computer.

This parameter applies only to Windows 2000 Professional computers that are members of a Windows 2000 Server domain. By default, Windows 2000 Server computers perform operations on the primary domain controller.

name [ ...]

Lists one or more user names or group names to add or remove from a local group. Separate multiple entries with a space. Names may be local users, users on other domains, or global groups, but not other local groups. If a user is from another domain, preface the user name with the domain name (for example, SALES\RALPHR).

/add

Adds a global group name or user name to a local group. An account must first be established for users or global groups before it is added to a local group with this command.

/delete

Removes a group name or user name from a local group.

Net name Adds or deletes a messaging name (sometimes called an alias), or displays the list of names the computer will accept messages for. The Messenger service must be running to use net name.

net name [name [/add | /delete]]

Parameters

none

Type net name without parameters to display a list of names currently in use.

name

Specifies the name to receive messages. The name can have as many as 15 characters.

/add

Adds a name to a computer. Typing /add is optional. Typing net name name works the same way as typing net name name /add.

/delete

Removes a name from a computer.

Page 53: W2K Cmd Line

Windows 2000 Command Line

Page 53 of 101

Net pause Pauses running services.

net pause service

Parameter

service

Is file service for macintosh (Windows 2000 Server only), ftp publishing service, lpdsvc, net logon, network dde, network dde dsdm, nt lm security support provider, remote access server, schedule, server, simple tcp/ip services, or workstation.

Net print Displays or controls print jobs and printer queues.

net print \\computername\sharename

net print [\\computername] job# [/hold | /release | /delete]

Parameters

computername

Specifies the name of the computer sharing the printer queue(s).

sharename

Specifies the name of the printer queue. When including the sharename with the computername, use a backslash (\) to separate the names.

job#

Specifies the identification number assigned to a print job in a printer queue. A computer with one or more printer queues assigns each print job a unique number. If a job number is being used in one printer queue shared by a computer, that number is not assigned to any other job on that computer, not even to jobs in other printer queues on that computer.

/hold

When used with job#, holds a print job waiting in the printer queue. The print job stays in the printer queue, and other print jobs bypass it until it is released.

/release

Releases a print job that has been held.

/delete

Removes a print job from a printer queue.

Net send Sends messages to other users, computers, or messaging names on the network. The Messenger service must be running to receive messages.

net send {name | * | /domain[:name] | /users} message

Parameters

name

Specifies the user name, computer name, or messaging name to send the message to. If the name is a computer name that contains blank characters, enclose the alias in quotation marks (" "). Long user names may lead to problems when used as NetBIOS names. NetBIOS names are limited to 16 characters, and Windows 2000 reserves the 16th character.

*

Sends the message to all the names in your domain or workgroup.

/domain[:name]

Sends the message to all the names in the computer's domain. If name is specified, the message is sent to all the names in the specified domain or workgroup.

/users

Sends the message to all users connected to the server.

message

Specifies text to be sent as a message.

Page 54: W2K Cmd Line

Windows 2000 Command Line

Page 54 of 101

Net session Lists or disconnects the sessions between a local computer and the clients connected to it.

net session [\\computername] [/delete]

Parameters

none

Type net session without parameters to display information about all sessions with the local computer.

\\computername

Identifies the computer for which to list or disconnect sessions.

/delete

Ends the computer's session with \\computername and closes all open files on the computer for the session. If \\computername is omitted, all sessions on the local computer are canceled.

Net share Creates, deletes, or displays shared resources.

net share sharename

net share sharename=drive:path [/users:number | /unlimited] [/remark:" text"]

net share sharename [/users:number | unlimited] [/remark:"text"]

net share {sharename | drive:path} /delete

Parameters

none

Type net share without parameters to display information about all resources being shared on the local computer.

sharename

Is the network name of the shared resource. Type net share with a sharename only to display information about that share.

drive:path

Specifies the absolute path of the directory to be shared.

/users:number

Sets the maximum number of users who can simultaneously access the shared resource.

/unlimited

Specifies an unlimited number of users who can simultaneously access the shared resource.

/remark:"text"

Adds a descriptive comment about the resource. Enclose the text in quotation marks.

/delete

Stops sharing the resource.

Net start Starts a service, or displays a list of started services. Service names of two or more words, such as Net Logon or Computer Browser, must be enclosed in quotation marks (").

net start [service]

Parameters

none

Type net start without parameters to display a list of running services.

service

Includes alerter, client service for netware, clipbook server, content index, computer browser, dhcp client, directory replicator, eventlog, ftp publishing service, hypermedia object manager, logical disk manager, lpdsvc, media services management, messenger, Fax Service, Microsoft install server, net logon, network dde, network dde dsdm, nt lm security support provider, ole, plug and play, remote access connection manager, remote access isnsap service, remote access server, remote procedure call (rpc) locator, remote procedure call (rpc) service, schedule, server, simple tcp/ip services, site server ldap service, smartcard resource manager, snmp, spooler, task scheduler, tcp/ip netbios helper, telephony service, tracking service, tracking (server) service, ups, Windows time service, and workstation.

Page 55: W2K Cmd Line

Windows 2000 Command Line

Page 55 of 101

These services are available only on Windows 2000 Server: file service for macintosh, gateway service for netware, microsoft dhcp service, print service for macintosh, windows internet name service.

Net start alerter Starts the Alerter service. The Alerter service sends alert messages.

net start alerter

Net start Client Service for NetWare Starts the Client Service for NetWare service. This command is available only on Windows 2000 Professional if Client Service for NetWare has been installed.

net start "client service for netware"

Net start ClipBook Server Starts the ClipBook Server service. Service names with two words, such as ClipBook Server, must be enclosed in quotation marks (").

net start "clipbook server"

Net start Computer Browser Starts the Computer Browser service.

net start "computer browser"

Net start DHCP Client Starts the DHCP Client service. This command is available only if the TCP/IP protocol has been installed.

net start "dhcp client"

Net start Directory Replicator Starts the Directory Replicator service. The Directory Replicator service copies designated files to specified servers. Service names with two words, such as Directory Replicator, must be enclosed in quotation marks ("). You can also start this service with the command net start replicator.

net start "directory replicator"

Net start Eventlog Starts the event logging service, which logs events on the local computer. This service must be started prior to using Event Viewer to view the logged events.

net start eventlog

Net start File Service for Macintosh Starts the File Service for Macintosh service, permitting the sharing of files with Macintosh computers. This command is available only on computers running Windows 2000 Server.

net start "file service for macintosh"

Net start FTP Publishing Service Starts the FTP Publishing Service. This command is available only if Internet Information Services have been installed.

net start "ftp publishing service"

Net start Gateway Service for NetWare Starts the Gateway Service for NetWare service. This command is available only on Windows 2000 Server if Gateway Service for NetWare has been installed.

net start "gateway service for netware"

Page 56: W2K Cmd Line

Windows 2000 Command Line

Page 56 of 101

Net start Lpdsvc Starts the TCP/IP Print Server service. This command is available only if Print Services for UNIX, as well as the TCP/IP protocol, have been installed.

net start lpdsvc

Net start Messenger Starts the Messenger service. The Messenger service enables a computer to receive messages.

net start messenger

Net start Microsoft DHCP Service Starts the Microsoft DHCP Service. This command is available only on computers running Windows 2000 Server and where the TCP/IP protocol and DHCP service have been installed.

net start "microsoft dhcp service"

Net start Net Logon Starts the Net Logon service. The Net Logon service verifies logon requests and controls replication of the user accounts database domainwide. Service names with two words, such as Net Logon, must be enclosed in quotation marks ("). This service can also be started with the command net start netlogon.

net start "net logon"

Net start Network DDE Starts the Network DDE service.

net start "network dde"

Net start NT LM Security Support Provider Starts the NT LM Security Support Provider service. This command is available only if the NT LM Security Support Provider has been installed.

net start "nt lm security support provider"

Net start OLE Starts the object linking and embedding service.

net start ole

Net start Print Server for Macintosh Starts the Print Server for Macintosh service, permitting printing from Macintosh computers. This command is available only on computers running Windows 2000 Server.

net start "print server for macintosh"

Net start Remote Access Connection Manager Starts the Remote Access Connection Manager service. This command is available only if the Remote Access Service has been installed.

net start "remote access connection manager"

Net start Remote Access ISNSAP Service Starts the Remote Access ISNSAP Service. This command is available only if the Remote Access Service has been installed.

net start "remote access isnsap service"

Net start Remote Procedure Call (RPC) Locator Starts the RPC Locator service. The Locator service is the RPC name service for Microsoft Windows 2000.

net start "remote procedure call (rpc) locator"

Page 57: W2K Cmd Line

Windows 2000 Command Line

Page 57 of 101

Net start Schedule Starts the Schedule service. The Schedule service enables a computer to start programs at a specified time with the at command.

net start schedule

Net start Server Starts the Server service. The Server service enables a computer to share resources on the network.

net start server

Net start Simple TCP/IP Services Starts the Simple TCP/IP Services service. This command is available only if TCP/IP and the Simple TCP/IP Services have been installed.

net start "simple tcp/ip services"

Net start Site Server LDAP Service Starts the Site Server LDAP Service. The Site Server LDAP Service publishes IP multicast conferences in the Windows 2000 Active Directory. This command is available only if Site Server LDAP Service has been installed.

net start "site server ldap service"

Net start SNMP Starts the SNMP service. The SNMP service allows a server to report its current status to a SNMP management system on a TCP/IP network. This command is available only if TCP/IP and SNMP have been installed.

net start snmp

Net start Spooler Starts the Spooler service.

net start spooler

Net start TCP/IP NetBIOS Helper Enables the Netbios Helper over TCP service. This command is available only if TCP/IP has been installed.

net start "tcp/ip netbios helper"

Net start UPS Starts the Uninterruptible Power Supply (UPS) service.

net start ups

Net start Windows Internet Name Service Starts the Windows Internet Name Service. This command is available only on Windows 2000 Servers if TCP/IP and the Windows Internet Name Service have been installed.

net start "windows internet name service"

Net start Workstation Starts the Workstation service. The Workstation service enables a computer to connect to and use network resources.

net start workstation

Net statistics Displays the statistics log for the local Workstation or Server service, or the running services for which statistics are available.

net statistics [workstation | server]

Parameters

none

Page 58: W2K Cmd Line

Windows 2000 Command Line

Page 58 of 101

Type net statistics without parameters to list the running services for which statistics are available.

workstation

Displays statistics for the local Workstation service.

server

Displays statistics for the local Server service.

Net stop Stops a Windows 2000 network service.

net stop service

Parameters

service

Includes the following services:

alerter network dde dsdm simple tcp/ip services

client service for netware nt lm security support provider site server LDAP service

clipbook server ole snmp

computer browser remote access connection manager spooler

directory replicator remote access isnsap service tcp/ip netbios helper

ftp publishing service remote access server ups

lpdsvc remote procedure call (rpc) locator workstation

messenger remote procedure call (rpc) service

net logon schedule

network dde server

The following services are available only on Windows 2000 Server:

File Service for Macintosh

Gateway Service for NetWare

Microsoft DHCP Service

Print Service for Macintosh

Windows Internet Name Service

Net time Synchronizes the computer's clock with that of another computer or domain. Used without the /set option, displays the time for another computer or domain.

net time [\\computername | /domain[:domainname] | /rtsdomain[:domainname]] [/set]

net time [\\computername] [/querysntp] | [/setsntp[:ntp server list]]

Parameters

none

Displays the current date and time at the computer designated as the time server for the local computer's Windows Server domain.

\\computername

Specifies the name of a server you want to check or with which you want to synchronize.

/domain[:domainname]

Specifies the domain with which to synchronize time.

/rtsdomain[:domainname]

Specifies the domain of the Reliable Time Server with which to synchronize time.

/set

Synchronizes the computer's clock with the time on the specified computer or domain.

Page 59: W2K Cmd Line

Windows 2000 Command Line

Page 59 of 101

/querysntp

Displays the name of the Network Time Protocol (NTP) server currently configured for the local computer or the one specified in \\computername.

/setsntp[:ntp server list]

Specifies a list of NTP time servers to be used by the local computer. The list may contain IP addresses or DNS names, separated by spaces. If multiple timeservers are used, the list must be surrounded by quotes.

Net use Connects a computer to or disconnects a computer from a shared resource, or displays information about computer connections. The command also controls persistent net connections.

net use [devicename | *] [\\computername\sharename[\volume]] [password | *]] [/user:[domainname\]username] [[/delete] | [/persistent:{yes | no}]]

net use devicename [/home[password | *]] [/delete:{yes | no}]

net use [/persistent:{yes | no}]

Parameters

none

Used without parameters, net use retrieves a list of network connections.

devicename

Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (D: through Z:) and printers (LPT1: through LPT3:). Type an asterisk instead of a specific device name to assign the next available device name.

\\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 may be from 1 to 15 characters long.

\volume

Specifies a NetWare volume on the server. You must have Client Service for NetWare (Windows 2000 Professional) or Gateway Service for NetWare (Windows 2000 Server) installed and running to connect to NetWare servers,

password

Specifies the password needed to access the shared resource.

*

Produces a prompt for the password. The password is not displayed when you type it at the password prompt.

/user

Specifies a different user name with which the connection is made.

domainname

Specifies another domain. For example, net use d:\\server\share /user:admin\mariel connects the user identifier mariel as

if the connection were made from the admin domain. If domainname is omitted, the current logged on domain is used.

username

Specifies the user name with which to log on.

/delete

Cancels the specified network connection. If the user specifies the connection with an asterisk, all network connections are canceled.

/home

Connects a user to the home directory.

/persistent

Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent.

yes

Saves all connections as they are made, and restores them at next logon.

no

Page 60: W2K Cmd Line

Windows 2000 Command Line

Page 60 of 101

Does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use the /delete switch to remove persistent connections.

Net user Adds or modifies user accounts or displays user account information.

net user [username [password | *] [options]] [/domain]

net user username {password | *} /add [options] [/domain]

net user username [/delete] [/domain]

Parameters

none

Used without parameters, net user displays a list of the user accounts on the computer.

username

Specifies the name of the user account to add, delete, modify, or view. The name of the user account can have as many as 20 characters.

password

Assigns or changes a password for the user's account. A password must satisfy the minimum length set with the /minpwlen option of the net accounts command. It can have as many as 127 characters. However, if you're using Windows 2000 on a network that also has computers using Windows 95 or Windows 98, consider using passwords not longer than 14 characters. Windows 95 and Windows 98 support passwords of up to 14 characters. If your password is longer, you may not be able to log on to your network from those computers.

*

Produces a prompt for the password. The password is not displayed when you type it at a password prompt.

/domain

Performs the operation on the primary domain controller of the computer's primary domain.

This parameter applies only to Windows 2000 Professional computers that are members of a Windows 2000 Server domain. By default, Windows 2000 Server computers perform operations on the primary domain controller.

Note

• This action is taken on the primary domain controller of the computer's primary domain. This may not be the logged-on domain.

/add

Adds a user account to the user accounts database.

/delete

Removes a user account from the user accounts database.

options

Specifies the following options:

/active:{no | yes}

Enables or disables the user account. If the user account is not active, the user cannot access resources on the computer. The default is yes (active).

/comment:"text"

Provides a descriptive comment about the user's account. This comment can have as many as 48 characters. Enclose the text in quotation marks.

/countrycode:nnn

Uses the operating-system Country/Region codes to implement the specified language files for a user's Help and error messages. A value of 0 signifies the default Country/Region code.

/expires:{date | never}

Page 61: W2K Cmd Line

Windows 2000 Command Line

Page 61 of 101

Causes the user account to expire if date is set; does not ever set a time limit on the user account. Expiration dates can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy format, depending on the Country/Region code. Note that the account expires at the beginning of the date specified. Months can be a number, spelled out, or abbreviated with three letters. Years can be two or four numbers. Use commas or slashes to separate parts of the date (no spaces). If yy is omitted, the next occurrence of the date (according to your computer's date and time) is assumed. For example, the following date entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995:

jan,9

1/9/95

january,9,1995

1/9

/fullname:"name"

Specifies a user's full name rather than a user name. Enclose the name in quotation marks.

/homedir:path

Sets the path for the user's home directory. The path must exist.

/passwordchg:{yes | no}

Specifies whether users can change their own password. The default is yes.

/passwordreq:{yes | no}

Specifies whether a user account must have a password. The default is yes.

/profilepath:[path]

Sets a path for the user's logon profile. This path points to a registry profile.

/scriptpath:path

Sets a path for the user's logon script. The path value cannot be an absolute path; path is relative to %systemroot%\System32\Repl\Import\Scripts.

/times:{times | all}

Specifies the times the user is allowed to use the computer. The times value is expressed as day[-day][,day[-day]] ,time[-time][,time[-time]], limited to 1-hour time increments. Days can be spelled out or abbreviated (M,T,W,Th,F,Sa,Su). Hours can be 12- or 24-hour notation. For 12-hour notation, use AM, PM, or A.M., P.M. The value all means a user can always log on. A null value (blank) means a user can never log on. Separate day and time with commas, and units of day and time with semicolons (for example, M,4AM-5PM;T,1PM-3PM). Do not use spaces when designating times.

/usercomment:"text"

Specifies that an administrator add or change the "User comment" for the account. Enclose the text in quotation marks.

/workstations:{computername[,...] | *}

Lists as many as eight workstations from which a user can log on to the network. Separate multiple entries in the list with commas. If /workstations has no list, or if the list is *, the user can log on from any computer.

Net view Displays a list of domains, a list of computers, or the resources being shared by the specified computer.

net view [\\computername | /domain[:domainname]]

net view /network:nw [\\computername]

Parameters

none

Used without parameters, net view displays a list of computers in your current domain.

\\computername

Specifies the computer whose shared resources you want to view.

/domain[:domainname]

Specifies the domain for which you want to view the available computers. If domainname is omitted, displays all domains in the network.

/network:nw

Displays all available servers on a NetWare network. If a computer name is specified, the resources available on that computer in the NetWare network are displayed. Other networks that are added to the system can also be specified with this switch.

Page 62: W2K Cmd Line

Windows 2000 Command Line

Page 62 of 101

Netsh The NetShell utility (netsh) is a command-line, scripting interface for configuring and monitoring Windows 2000. The configuration tool provides an interactive shell interface to the user. The front end is the command shell that accepts your commands, and the back end is a helper that corresponds to a system component or utility. A helper is a Dynamic Link Library file (.dll) that extends the functionality of netsh. A helper provides configuration and/or monitoring support for one or more services, utilities, or protocols, but helpers can also be used to extend other helpers. The command shell directs the command to the appropriate helper, and the helper carries out the command. The netsh command allows you to run the NetShell utility to display or modify the configuration of a currently running computer. It also provides a scripting feature that you can use to run a collection of commands in batch mode against a specified computer. Contexts The command shell provides for contexts, which are groupings of netsh commands for specific networking components. A context is identified by a string that is appended to commands. Commands entered in a given context are passed to an associated helper. The contexts available depend on the Windows 2000 components installed. For example, typing routing at the netsh command changes to the routing context. Typing ras at the netsh command changes to the ras (remote access portion of the Routing and Remote Access service) context. Subcontexts may exist within each context. For example, within the routing context, you can change to the ip and ipx subcontexts. netsh [-r RemoteComputer] [-a AliasFile] [-c Context] [Command | -f ScriptFile] To display a list of subcontexts and commands that can be used in a context, at the netsh prompt, type the context name, followed by a space and ?. For example, to display a list of subcontexts and commands that can be used in the routing context, at the netsh prompt, type the following: netsh>routing ? Netsh Commands As well as the context commands shown above, the following additional commands can be used with Netsh. Optional parameters are shown in brackets ([ ]). Alternative entries are shown with a pipe (|) between them.

Command Result ? Displays help. abort Discards any changes made in offline mode. No effect in online mode. add helper DLL-name Installs the helper DLL in netsh.

alias [alias-name] [string1] [string2 ...]

If alias, lists all aliases.

If alias alias-name, displays the equivalent string.

If alias alias-name string1 string2 ..., sets alias-name to the specified strings.

bye Exits the program. commit Commits any changes made in the offline mode to the router. No effect in the online mode. delete helper DLL-name Removes the helper DLL from netsh. dump -file-name Dumps or appends configuration to a text file. exec Script-file-name Loads the script file and executes commands from it. exit Exits the program. h Displays help. help Displays help. offline Sets the current mode to offline. Any changes made in this mode will be saved, but require a

commit or online command to be set in the router. online Sets the current mode to online. Any changes in this mode will be immediately reflected in the

router. popd Pops a context from the stack. pushd Pushes current context onto the stack. quit Exits the program set mode [mode =] online | offline Sets the current mode to online or offline.

show alias | helper | mode

If show alias, lists all defined aliases.

If show helper, lists all top-level helpers.

If show mode, shows the current mode.

unalias alias-name Deletes the specified alias.

Page 63: W2K Cmd Line

Windows 2000 Command Line

Page 63 of 101

Netstat Displays protocol statistics and current TCP/IP network connections. This command is available only if the TCP/IP protocol has been installed. netstat [-a] [-e] [-n] [-s] [-p protocol] [-r] [interval] Parameters -a Displays all connections and listening ports. Server connections are normally not shown. -e Displays Ethernet statistics. This may be combined with the -s option. -n Displays addresses and port numbers in numerical form (rather than attempting name look-ups). -s Displays per-protocol statistics. By default, statistics are shown for TCP, UDP, ICMP, and IP. The -p option can be used to specify a subset of the default. -p protocol Shows connections for the protocol specified by protocol; protocol can be tcp or udp. If used with the -s option to display per-protocol statistics, protocol can be tcp, udp, icmp, or ip. -r Displays the contents of the routing table. interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+B to stop redisplaying statistics. If this parameter is omitted, netstat prints the current configuration information once.

Nlsfunc Loads country-specific information. Windows 2000 and the MS-DOS subsystem do not use this command. It is accepted only for compatibility with MS-DOS files.

Nslookup This diagnostic tool displays information from Domain Name System (DNS) name servers. Before using this tool, you should be familiar with how DNS works. Nslookup is available only if the TCP/IP protocol has been installed. Modes Nslookup has two modes: interactive and noninteractive. If you need to look up only a single piece of data, use noninteractive mode. For the first argument, type the name or IP address of the computer to be looked up. For the second argument, type the name or IP address of a DNS name server. If you omit the second argument, the default DNS name server is used. If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first argument and the name or IP address of a DNS name server for the second argument. Or, omit both arguments and the default DNS name server is used. nslookup [-option ...] [computer-to-find | - [server]] Parameters -option ... Specifies one or more nslookup commands as a command-line option. For a list of commands, see Nslookup Subcommands. Each option consists of a hyphen (-) followed immediately by the command name and, in some cases, an equal sign (=) and then a value. For example, to change the default query type to host (computer) information and the initial time-out to 10 seconds, you would type:

nslookup -querytype=hinfo -timeout=10

The command line length must be less than 256 characters. computer-to-find Looks up information for computer-to-find using the current default server or using server if specified. If computer-to-find is an IP address and the query type is A or PTR, the name of the computer is returned. If computer-to-find is a name and does not have a trailing period, the default DNS domain name is appended to the name. This behavior depends on the state of the set options: domains, srchlist, defname, and search. To look up a computer not in the current DNS domain, append a period to the name. If you type a hyphen (-) instead of computer-to-find, the command prompt changes to nslookup interactive mode. server Specifies to use this server as the DNS name server. If you omit server, the default DNS name server is used.

Page 64: W2K Cmd Line

Windows 2000 Command Line

Page 64 of 101

Nslookup subcommands Select one of the following nslookup commands to get more information: Nslookup: help Nslookup: exit Nslookup: finger Nslookup: ls Nslookup: lserver Nslookup: root Nslookup: server Nslookup: set Nslookup: set all Nslookup: set cl[ass] Nslookup: set [no]deb[ug] Nslookup: set [no]d2 Nslookup: set [no]def[name] Nslookup: set do[main] Nslookup: set [no]ig[nore] Nslookup: set po[rt] Nslookup: set q[uerytype] Nslookup: set [no]rec[urse] Nslookup: set ret[ry] Nslookup: set ro[ot] Nslookup: set [no]sea[rch] Nslookup: set srchl[ist] Nslookup: set ti[meout] Nslookup: set ty[pe] Nslookup: set [no]v[c] Nslookup: view

Ntcmdprompt Runs the Windows 2000 command interpreter Cmd.exe, rather than Command.com, after running a TSR or after starting the command prompt from within an MS-DOS application. ntcmdprompt

OS/2 configuration commands Select a command to get more information. codepage devinfo libpath protshell You configure the OS/2 subsystem with Config.sys commands, such as devicename or libpath. Use an OS/2 editor to edit C:\Config.sys. These commands affect only the OS/2 subsystem.

Path Sets a search path for executable files. Windows 2000 uses the path command to search for executable files in the directories you specify. By default, the search path is the current directory only. path [[drive:]path[;...]] [%path%] Parameters none Used without parameters, path displays the current search path. [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 Windows 2000 is to search only the current directory. %path% Appends current path to the new setting.

PathPing A route tracing tool that combines features of the ping and tracert commands with additional information that neither of those commands provides. The pathping command sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since pathping shows the degree of packet loss at any given router or link, you can determine which routers or links might be causing network problems. pathping [-n] [-h maximum_hops] [-g host-list] [-p period] [-q num_queries [-w timeout] [-T] [-R] target_name Parameters -n Does not resolve addresses to host names.

Page 65: W2K Cmd Line

Windows 2000 Command Line

Page 65 of 101

-h maximum_hops Specifies maximum number of hops to search for the target. Default is 30 hops. -g host-list Allows consecutive computers to be separated by intermediate gateways (loose source route) along host-list. -p period Specifies number of milliseconds to wait between consecutive pings. Default is 250 milliseconds (1/4 second). -q num_queries Specifies number of queries to each computer along the route. Default is 100. -w timeout Specifies number of milliseconds to wait for each reply. Default is 3000 milliseconds (3 seconds). -T Attaches a layer-2 priority tag (for example, 802.1p) to the ping packets that it sends to each of the network devices along the route. This helps identify network devices that do not have layer-2 priority configured. This parameter must be capitalized. -R Checks to see if each network device along the route supports the Resource Reservation Setup Protocol (RSVP), which allows the host computer to reserve a certain amount of bandwidth for a data stream. This parameter must be capitalized. target_name Specifies the destination endpoint, identified either by IP address or host name.

Pause Suspends processing of a batch program and displays a message prompting the user to press any key to continue. pause

Pax Starts the Portable Archive Interchange (Pax) utility. Pax is a POSIX program and path names used as arguments must be specified in POSIX format. Use "//C/Users/Default" instead of "C:\USERS\DEFAULT." Combinations of the -r and -w command line arguments specify whether pax will read, write or list the contents of the specified archive, or move the specified files to another directory. pax [-cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...] pax -r [-cimnopuvy] [-f archive] [-s replstr] [-t device] [pattern...] pax -w [-adimuvy] [-b blocking] [-f archive] [-s replstr] [-t device] [-x format] [pathname...] pax -rw [-ilmopuvy] [-s replstr] [pathname...] directory Parameters -r Reads an archive file from the standard input. Only files with names that match any of the pattern operands are selected for extraction. The selected files are conditionally created and copied relative to the current tree, subject to the options described following this paragraph. By default, the owner and group of selected files will be that of the invoking process, and the permissions and modification times will be the same as those in the archive. The supported archive formats are automatically detected on input. The default output format is ustar, but may be overridden by -x format. -w Writes the files and directories specified by the pathname operands to the standard output together with the path and status information prescribed by the archive format used. A directory pathname operand refers to the files and (recursively) subdirectories of that directory. If no pathname operands are given, then the standard input is read to get a list of paths to copy, one path per line. In this case, only those paths appearing on the standard input are copied. -rw Reads the files and directories named in the pathname operands and copies them to the destination directory. A directory pathname operand refers to the files and (recursively) subdirectories of that directory. If no pathname operands are given, the standard input is read to get a list of paths to copy, one path per line. In this case, only those paths appearing on the standard input are copied. The directory named by the directory operand must exist and have the proper permissions before the copy can occur. -a Appends the files specified by pathname to the specified archive. -b blocking Blocks the output at blocking bytes per write to the archive file. A k suffix multiplies blocking by 1024, a b suffix multiplies blocking by 512, and an m suffix multiplies blocking by 1,048,576 (1 MB). If not specified, blocking is automatically determined on input and is ignored for -rw. -c Complements the match sense of the pattern operands. -d Indicates that intermediate directories not explicitly listed in the archive are not created. This option is ignored unless the -r option is specified. -f archive The archive option specifies the path of the input or output archive, overriding the default of standard input for -r or standard output for -w. -i Interactively renames files. Substitutions specified by -s options are performed before requesting the new file name from the user. A file is skipped if an empty line is entered and the pax command exits with an exit status of zero if EOF is encountered. -l Indicates that files are linked rather than copied when possible. -m

Page 66: W2K Cmd Line

Windows 2000 Command Line

Page 66 of 101

Indicates that file modification times are not retained. -n When -r is specified, but -w is not, the pattern arguments are treated as ordinary file names. Only the first occurrence of each of these files in the input archive is read. The pax command exits with a zero exit status after all files in the list have been read. If one or more files in the list is not found, pax writes a diagnostic to standard error for each of the files and exits with a nonzero exit status. The file names are compared before any of the -i, -s, or -y options are applied. -o Restores file ownership as specified in the archive. The invoking process must have appropriate privileges to accomplish this. -p Preserves the access time of the input files after they have been copied. -s replstr Modifies file names according to the substitution expression using the syntax of ed(1) as shown:

-s /old/new/[gp] Any non-null character may be used as a delimiter (a forward slash is used here as an example). Multiple -s expressions may be specified; the expressions are applied in the order specified terminating with the first successful substitution. The optional trailing p causes successful mappings to be listed on standard error. The optional trailing g causes the old expression to be replaced each time it occurs in the source string. Files that substitute to an empty string are ignored both on input and output. -t device The device option argument is an implementation-defined identifier that names the input or output archive device, overriding the default of standard input for -r and standard output for -w. -u Copies each file only if it is newer than a preexisting file with the same name. This implies -a. -v Lists file names as they are encountered. Produces a verbose table of contents listing on the standard output when both -r and -w are omitted, otherwise the file names are printed to standard error as they are encountered in the archive. -x format Specifies the output archive format. The input format, which must be one of the following, is automatically determined when the -r option is used. The following formats are supported.

cpio The extended CPIO interchange format specified in Extended CPIO Format in IEEE Std. 1003.1-1988. ustar The extended TAR interchange format specified in Extended TAR Format in IEEE Std. 1003.1-1988. This is the default

archive format. -y Prompts for the disposition of each file. Substitutions specified by -s options (described previously) are performed before prompting the user for disposition. EOF or an input line starting with the character q causes pax to exit. Otherwise, an input line starting with anything other than y causes the file to be ignored. This option cannot be used in conjunction with the -i option. Only the last of multiple -f or -t options take effect. directory Contains the destination directory path for copies when both the -r and -w options are specified. The directory must exist and be writable before the copy or an error results. pathname Specifies a file whose contents are used instead of the files named on the standard input. When a directory is named, all of its files and subdirectories are copied as well. pattern A pattern is given using wildcards. The default is all files.

Pentnt Detects floating point division error (if present) in the Pentium chip, disables floating point hardware, and turns on floating point emulation. pentnt [-c] [-f] [-o] [-?|-h] Parameters -c Enables conditional emulation. Floating-point emulation is forced on only if the system detects the Pentium processor floating-point division error at start time. If you select this parameter, you must restart the computer for the changes to take effect. -f Enables forced emulation. Floating-point hardware is disabled and floating-point emulation is always forced on, regardless of whether the system exhibits the Pentium processor floating-point division error. This parameter is useful for testing software emulators and for working around floating-point hardware defects known to the operating system. If you select this parameter, you must restart the computer for the changes to take effect. -o Disables forced emulation and reenables floating-point hardware if it is present. If you select this parameter, you must restart the computer for the changes to take effect. -?|-h Displays Help for the command.

Ping Verifies connections to a remote computer or computers. This command is available only if the TCP/IP protocol has been installed. ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [[-j computer-list] | [-k computer-list]] [-w timeout] destination-list

Page 67: W2K Cmd Line

Windows 2000 Command Line

Page 67 of 101

Parameters -t Pings the specified computer until interrupted. -a Resolves addresses to computer names. -n count Sends the number of ECHO packets specified by count. The default is 4. -l length Sends ECHO packets containing the amount of data specified by length. The default is 32 bytes; the maximum is 65,527. -f Sends a Do not Fragment flag in the packet. The packet will not be fragmented by gateways on the route. -i ttl Sets the Time To Live field to the value specified by ttl. -v tos Sets the Type Of Service field to the value specified by tos. -r count Records the route of the outgoing packet and the returning packet in the Record Route field. A minimum of 1 and a maximum of 9 computers can be specified by count. -s count Specifies the timestamp for the number of hops specified by count. -j computer-list Routes packets by way of the list of computers specified by computer-list. Consecutive computers can be separated by intermediate gateways (loose source routed). The maximum number allowed by IP is 9. -k computer-list Routes packets by way of the list of computers specified by computer-list. Consecutive computers cannot be separated by intermediate gateways (strict source routed). The maximum number allowed by IP is 9. -w timeout Specifies a time-out interval in milliseconds. destination-list Specifies the remote computers to ping.

Popd Changes to the directory stored by the pushd command. The popd command can be used only once to change directories. The buffer is cleared after the first use. When command extensions are enabled (the default in Windows 2000), the popd command deletes any temporary drive letter created by pushd. popd

Portuas Merges a LAN Manager 2.x user accounts database into an existing Windows 2000 user accounts database. portuas -f filename [-u username] [-v] [/codepage codepage] [/log filename] Parameters -f filename Specifies the LAN Manager 2.x NET.ACC file. -u username Specifies a single user or group to restore. -v Displays all messages (verbose). /codepage codepage Specifies the OEM code page the LAN Manager 2.x NET.ACC file is in. /log filename Specifies a file to log results.

Print Prints a text file or displays the contents of a print queue. This command can print in the background if you have an output device connected to one of your system's serial or parallel ports. print [/d:device] [[drive:][path] filename[ ...]] Parameters none Used without parameters, print displays the contents of the print queue. /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. You can also specify a network printer by its sharename (\\servername\print_share). The default value is PRN. The values PRN and LPT1 refer to the same parallel port. [drive:][path] filename Specifies the location and name of a file or set of files you want to print. You can include multiple files on one command line.

Page 68: W2K Cmd Line

Windows 2000 Command Line

Page 68 of 101

For information about configuring a printer connected to a parallel port, click Mode (configure printer) in the list. For information about displaying the status of a printer, click MODE (display device status) in the list. For information about configuring a printer connected to a serial port, click MODE (redirect printing) in the list. For information about preparing printers for code page switching, click MODE (set device code pages) in the list.

Prompt Changing the Windows 2000 command prompt (Cmd.exe) 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 Windows 2000 version number. prompt [text] Parameters none Used without parameters, prompt resets the command prompt to the default setting, the current drive letter followed by the current directory and a greater-than symbol (>). 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, one or more character strings in the text parameter. The list includes a brief description of the text or information that each character combination adds to your command prompt.

Character Description $q = (equal sign) $$ $ (dollar sign) $t Current time $d Current date $p Current drive and path $v Windows 2000 version number $n Current drive $g > (greater-than sign) $l < (less-than sign) $b | (pipe) $_ ENTER-LINEFEED $e ANSI escape code (code 27) $h Backspace (to delete a character that has been written to the prompt command line)

$a & (ampersand) $c ( (left parenthesis) $f ) (right parenthesis) $s space When command extensions are enabled (the default in Windows 2000), the prompt command supports the following additional formatting characters:

Character Description $+ Zero or more plus sign (+) characters depending upon the depth of the pushd directory stack, one character for

each level pushed. $m The remote name associated with the current drive letter or the empty string if current drive is not a network

drive.

Protshell Windows 2000 and the OS/2 subsystem do not use this command. It is accepted only for compatibility with files from MS OS/2 version 1.3 or earlier.

Pushd Stores the name of the current directory for use by the popd command, then changes to the specified directory. pushd [path] Parameter path Specifies the directory to make the current directory. This command supports relative paths. If command extensions are enabled (the default in Windows 2000), the pushd command accepts either a network path or a local drive letter and path.

Page 69: W2K Cmd Line

Windows 2000 Command Line

Page 69 of 101

When a network path is specified, pushd creates a temporary drive letter for the specified network resource and then changes the current drive and directory to the specified directory on the newly defined drive. Temporary drive letters are allocated using the first unused drive letter found. When you use the popd command, it deletes any temporary drive letter created by pushd.

QBasic Starts Windows 2000 QBasic, a program that reads instructions written in the Basic computer language and interprets them into executable computer code. qbasic [/b] [/editor] [/g] [/h] [/mbf] [/nohi] [[/run][drive:][path] filename] Parameters /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 file name. [drive:][path] filename Specifies the location and name of the file to load when QBasic starts.

Rcp Copies files between a Windows 2000 computer and a system running rshd, the remote shell daemon. The rcp command, a connectivity command, can also be used for other transfer to copy files between two computers running rshd when the command is issued from a Windows 2000 computer. The rshd daemon is available on UNIX computers, but not on Windows 2000, so the Windows 2000 computer can only participate as the system from which the commands are issued. The remote computer must also provide the rcp utility by running rshd. rcp [-a | -b] [-h] [-r] source1 source2 ... sourceN destination Parameters -a Specifies ASCII transfer mode. This mode converts the carriage return/line feed characters to carriage returns on outgoing files and line feed characters to carriage return/line feed characters for incoming files. This is the default transfer mode. -b Specifies binary image transfer mode. No carriage return/line feed conversion is performed. -h Transfers source files marked with the hidden attribute on the Windows 2000 computer. Without this option, specifying a hidden file on the rcp command line has the same effect as if the file did not exist. -r Recursively copies the contents of all subdirectories of the source to the destination. Both the source and destination must be directories, although using -r works even if the source is not a directory. There just will be no recursion. source and destination Must be of the form [computer[.user]:]filename. If the [computer[.user]:] portion is omitted, the computer is assumed to be the local computer. If the [.user] portion is omitted, the currently logged on Windows 2000 user name is used. If a fully qualified computer name is used, which contains the period (.) separators, then the [.user] must be included. Otherwise, the last part of the computer name will be interpreted as the user name. If multiple source files are specified, the destination must be a directory. If the file name does not begin with a forward slash (/) for UNIX or a backward slash (\) for Windows 2000 systems, it is assumed to be relative to the current working directory. On Windows 2000, this is the directory from which the command is issued. On the remote system, it is the logon directory for the remote user. A period (.) means the current directory. Use the escape characters (\ , ", or ') in remote paths to use wildcard characters on the remote computer.

Recover Recovers readable information from a bad or defective disk. The recover command reads a file sector by sector and recovers data from the good sectors. Data in bad sectors is lost. recover [drive:][path] filename Parameter [drive:][path] filename Specifies the location and name of the file you want to recover.

Page 70: W2K Cmd Line

Windows 2000 Command Line

Page 70 of 101

Redirection Redirection characters change where a command gets information from or sends information to. Redirecting command input and output Unless you specify otherwise, Windows 2000 receives input from your keyboard and sends output to your screen. Sometimes it is useful to redirect the input or output to a file or a printer. For example, you might want to redirect a directory listing from the screen to a file. To redirect the input or output of a command, use one of the following redirection characters:

• The greater-than sign (>) sends the output of a command to a file or a device, such as a printer. Some command output, such as error messages, cannot be redirected when using the greater-than sign (>).

• The less-than sign (<) takes the input needed for a command from a file rather than from the keyboard. • The double greater-than sign (>>) adds output from a command to the end of a file without deleting the information

already in the file. • The >& sign redirects the output from one of the default I/O streams (stdout, stdin, stderr) into another. For

example, command >output_file 2>&1 redirects any error messages from the processing of command from the

screen to the standard file output. The numeric values of the standard outputs are as follows:

Standard output Numeric equivalent Stdin 0 Stdout 1 Stderr 2

Redirecting the output of a command Almost all commands send output to your screen. Even commands that send output to a drive or printer also display messages and prompts on your screen. To redirect the output from the screen to a file or printer, use the greater-than sign (>). You can use the greater-than sign with most Windows 2000 commands. For example, in the following command, the directory listing produced by the dir command is redirected to the Dirlist.txt file:

dir > dirlist.txt If the Dirlist.txt file doesn't exist, Windows 2000 creates it. If Dirlist.txt exists, Windows 2000 replaces the information in the file with the output from the dir command. To add the output from a command to the end of a file without losing any of the information already in the file, use a double greater-than sign (>>). For example, in the following command, the directory listing produced by the dir command is appended to the Dirlist.txt file:

dir >> dirlist.txt Redirecting the input to a command Just as you can send the output of a command to a file or printer rather than to your screen, you can take the input for a command from a file rather than from the keyboard. To take input from a file, use the less-than sign (<). For example, the following command takes the input for the sort command from the List.txt file:

sort < list.txt Windows 2000 alphabetizes the lines of the List.txt file and displays the result on your screen.

Rem Enables you to include comments (remarks) in a batch file or in your configuration files. rem [comment] Parameter comment Specifies any string of characters you want to include as a comment.

Rename (Ren) Changes the name of a file or a set of files. You can rename all files matching the specified file name. You cannot use the rename command to rename files across drives or to move files to a different directory location. rename [drive:][path] filename1 filename2 ren [drive:][path] filename1 filename2 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. If you use wildcards (* and ?), filename2 specifies the new names for the files. You cannot specify a new drive or path when renaming files.

Page 71: W2K Cmd Line

Windows 2000 Command Line

Page 71 of 101

Replace Replaces files in the destination directory with files in the source directory that have the same name. You can also use replace to add unique file names to the destination directory. replace [drive1:][path1] filename [drive2:][path2] [/a] [/p] [/r] [/w] replace [drive1:][path1] filename [drive2:][path2] [/p] [/r] [/s] [/w] [/u] Parameters [drive1:][path1] filename Specifies the location and name of the source file or set of files. [drive2:][path2] Specifies the location of the destination file. You cannot specify a file name for files you replace. If you specify neither a drive nor a directory, replace uses the current drive and directory as the destination. /a Adds new files to the destination directory instead of replacing existing files. You cannot use this switch with the /s or /u switch. /p Prompts you for confirmation before replacing a destination file or adding a source file. /r Replaces read-only files as well as unprotected files. If you do not specify this switch but attempt to replace a read-only file, an error results and stops the replacement operation. /w Waits for you to insert a disk before replace begins to search for source files. If you do not specify /w, replace begins replacing or adding files immediately after you press ENTER. /s Searches all subdirectories of the destination directory and replaces matching files. You cannot use the /s switch with the /a switch. The replace command does not search subdirectories specified in path1. /u Replaces (updates) only those files on the destination directory that are older than those in the source directory. You cannot use the /u switch with the /a switch.

% (Replaceable parameter) The replaceable parameters %0 and %1 to %9 can be placed anywhere within a batch file. When the batch file is run, %0 is replaced by the name of the batch file, and the argument variables %1 to %9 are replaced by the corresponding parameters entered on the command line. For example, to copy the contents of one folder to another, you would add the following statement in your batch file: xcopy %1\*.* %2 When you run the file, you would type the following: mybatch.bat C:\afolder D:\bfolder. The effect is the same as if you had written xcopy C:\afolder \*.* D:\bfolder in the batch file. The % parameter expands the batch script argument variables (%0, %1, ..., %9) as follows: %* in a batch script is a wildcard reference to all the arguments. For individual argument variables, the expansion options are explained in the following tables.

Variable Description %~1 expands %1 and removes any surrounding quotes (") %~f1 expands %1 to a fully qualified path name %~d1 expands %1 to a drive letter %~p1 expands %1 to a path %~n1 expands %1 to a file name %~x1 expands %1 to a file extension %~s1 expanded path contains short names only %~a1 expands %1 to file attributes %~t1 expands %1 to date/time of file %~z1 expands %1 to size of file

%~$PATH:1 searches the directories listed in the PATH environment variable and expands %1 to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string.

The modifiers can be combined to get compound results:

Variable Description %~dp1 expands %1 to a drive letter and path %~nx1 expands %1 to a file name and extension %~dp$PATH:1 searches the directories listed in the PATH environment variable for %1 and expands to the drive letter and

path of the first one found %~ftza1 expands %1 to a dir-like output line

Page 72: W2K Cmd Line

Windows 2000 Command Line

Page 72 of 101

In the above examples %1 and PATH can be replaced by other valid values. The %~ syntax must be terminated by a valid argument number. The %~ modifiers may not be used with %*.

Rexec Runs commands on remote computers running the REXEC service. The rexec command authenticates the user name on the remote computer before executing the specified command, and is available only if the TCP/IP protocol has been installed. rexec computer [-l username] [-n] command Parameters computer Specifies the remote computer on which to run command. -l username Specifies the user name on the remote computer. -n Redirects the input of rexec to NULL. command Specifies the command to run.

Rmdir (Rd) Removes (deletes) a directory. rmdir [drive:]path [/s] [/q] rd [drive:]path [/s] [/q] Parameters [drive:]path Specifies the location and name of the directory you want to delete. /s Removes the specified directory and all subdirectories including any files. Used to remove a tree. /q Runs rmdir in quiet mode. Deletes directories without confirmation.

Route Manipulates network routing tables. This command is available only if the TCP/IP protocol has been installed. route [-f] [-p] [command [destination] [mask subnetmask] [gateway] [metric costmetric]] Parameters -f Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command. -p When used with the add command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. When used with the print command, displays the list of registered persistent routes. Ignored for all other commands, which always affect the appropriate persistent routes. command Specifies one of the following commands.

Command Purpose print Prints a route add Adds a route delete Deletes a route change Modifies an existing route destination Specifies the computer to send command. mask subnetmask Specifies a subnet mask to be associated with this route entry. If not specified, 255.255.255.255 is used. gateway Specifies gateway. All symbolic names used for destination or gateway are referenced in both the network database file called Networks, and the computer name database file called Hosts. If the command is print or delete , wildcards may be used for the destination and gateway, or the gateway argument may be omitted. metric costmetric Assigns an integer cost metric (ranging from 1 to 9999) to be used in calculating the fastest, most reliable, and/or least expensive routes.

Page 73: W2K Cmd Line

Windows 2000 Command Line

Page 73 of 101

Rsh Runs commands on remote computers running the RSH service. This command is available only if the TCP/IP protocol has been installed. rsh computer [-l username] [-n] command Parameters computer Specifies the remote computer on which to run command. -l username Specifies the user name to use on the remote computer. If omitted, the logged on user name is used. -n Redirects the input of rsh to NULL. command Specifies the command to run.

Runas Allows a user to run specific tools and programs with different permissions than the user's current logon provides. It is good practice for administrators to use an account with restrictive permissions to perform routine, nonadministrative tasks, and to use an account with broader permissions only when performing specific administrative tasks. To accomplish this without logging off and back on, log on with a regular user account and use the runas command to run the tools that require the broader permissions. runas [/profile] [/env] [/netonly] /user:UserAccountName program Parameters /profile Specifies the name of the user's profile, if it needs to be loaded. /env Specifies that the current network environment be used instead of the user's local environment. /netonly Indicates that the user information specified is for remote access only. /user:UserAccountName Specifies the name of the user account under which to run the program. The user account format should be user@domain or domain\user. program Specifies the program or command to run using the account specified in /user. For examples of the use of the runas command starting other Windows 2000 commands, see .

Set Displays, sets, or removes Windows 2000 environment variables. You use environment variables to control the behavior of some batch files and programs and to control the way Windows 2000 and the MS-DOS subsystem appears and works. The set command is often used in the Autoexec.nt file to set environment variables. set [variable=[string]] Parameters none Used without parameters, set displays the current environment settings. variable Specifies the variable you want to set or modify. string Specifies the string you want to associate with the specified variable.

Setlocal Begins localization of environment variables in a batch file. Localization lasts until a matching endlocal command is encountered, or the end of the batch file is reached setlocal option Parameter option When command extensions are enabled (the default in Windows 2000), the setlocal batch command accepts an optional argument, which can be either enableextensions or disableextensions. This enables or disables the command extensions until the matching endlocal command, regardless of their setting prior to the setlocal command. The setlocal command also sets the errorlevel value when it is passed an argument. The errorlevel value is set to zero (0) if one of the two valid arguments is given and set to one (1) otherwise.

Page 74: W2K Cmd Line

Windows 2000 Command Line

Page 74 of 101

Setver Sets the MS-DOS version number that the MS-DOS subsystem reports to a program. setver [drive:path] [filename n.nn] setver [drive:path] [filename [/delete [/quiet]] To display the current version table, use the following syntax: setver [drive:path] Parameters none Used without parameters, the setver command displays the current version table. [drive:path] Specifies the location of the Setver.exe file. filename Specifies the name of the program file (.exe or .com) that you want to add to the version table. You cannot use a wildcard (* or ?). n.nn Specifies the MS-DOS version (for example, 3.3 or 4.01) that the MS-DOS subsystem reports to the specified program file. /delete Deletes the version table entry for the specified program file. You can abbreviate this switch as /d. /quiet Hides the message typically displayed during deletion of an entry from the version table.

Share Windows 2000 and the MS-DOS subsystem do not use this command. It is accepted only for compatibility with MS-DOS files.

Shell Specifies the name and location of an alternate command interpreter you want Windows 2000 to use for the MS-DOS subsystem. shell=[[drive:]path] filename [parameters] Parameters [[drive:]path] filename Specifies the location and name of the command interpreter you want Windows 2000 to use. parameters Specifies any command-line parameters or switches that can be used with the specified command interpreter.

Shift Changes the position of replaceable parameters in a batch file. shift When command extensions are enabled (the default setting in Windows 2000), the shift command supports the /n switch, which tells the command to start shifting at the nth argument, where n can be a value from zero to eight. For example,

SHIFT /2

would shift %3 to %2, %4 to %3, and so on, and leave %0 and %1 unaffected.

Sort Reads input, sorts data, and writes the results to the screen, to a file, or to another device. sort [/r] [/+n] [/m kilobytes] [/l locale] [/rec characters] [[drive1:][path1]filename1] [/t [drive2:][path2]] [/o [drive3:][path3]filename3] [command |] sort [/r] [/+n] [/m kilobytes] [/l locale] [/rec characters] [[drive1:][path1]filename1] [/t [drive2:][path2]] [/o [drive3:][path3]filename3] Parameters /r Reverses the sort order; that is, sorts from Z to A, and then from 9 to 0. /+n

Specifies the character position number, n, at which sort begins each comparison. For example, /+3 indicates that each

comparison should begin at the third character in each line. Lines with fewer than n characters collate before other lines. By default, comparisons start at the first character in each line. /m kilobytes Specifies the amount of main memory to use for the sort, in kilobytes (KB). The memory used is always a minimum of 160 KB. If the memory size is specified, the exact specified amount (but at least 160 KB) is used for the sort, regardless of how much main memory is available. The default maximum memory size when no size is specified is 90 percent of available main memory if both the input and output are files, and 45 percent of main memory otherwise. The default setting usually gives the best performance. /l locale

Page 75: W2K Cmd Line

Windows 2000 Command Line

Page 75 of 101

Overrides the sort order of characters defined by the system default locale; that is, the language and Country/Region selected when Windows 2000 was installed. Currently, the only alternative to the default locale is the "C" locale, which is faster than natural language sorting and sorts characters according to their binary encodings. /rec characters Specifies the maximum number of characters in a record, or a line of the input file (the default is 4,096, and the maximum is 65,535). [drive1:][path1]filename1 Specifies the file to be sorted. If no file name is specified, the standard input is sorted. Specifying the input file is faster than redirecting the same file as standard input. /t [drive2:][path2] Specifies the path of the directory to hold the sort command's working storage, in case the data does not fit in main memory. The default is to use the system temporary directory. /o [drive3:][path3]filename3 Specifies the file where the sorted input is to be stored. If not specified, the data is written to the standard output. Specifying the output file is faster than redirecting standard output to the same file.

Stacks Supports the dynamic use of data stacks to handle hardware interrupts. To use this environment variable, place it in your Config.nt file. stacks=n,s Parameters n Specifies the number of stacks. Valid values for n are 0 and numbers in the range 8 through 64. s Specifies the size, in bytes, of each stack. Valid values for s are 0 and numbers in the range 32 through 512.

Start Starts a separate window to run a specified program or command. start ["title"] [/dpath] [/i] [/min] [/max] [/separate| /shared] [/low|/normal|/high|/realtime] [/wait] [/b] [filename] [parameters] Parameters none Used without parameters, start opens a second command prompt window. "title" Specifies the title to display in window title bar. /d path Specifies the startup directory. /i Passes the Cmd.exe startup environment to the new window. /min Starts a new minimized window. /max Starts a new maximized window. /separate Starts 16-bit Windows programs in separate memory space. /shared Starts 16-bit Windows programs in shared memory space. /low Starts an application in the idle priority class. /normal Starts an application in the normal priority class. /high Starts an application in the high priority class. /realtime Starts an application in the realtime priority class. /wait Starts an application and waits for it to end. /b Does not create a new window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application. filename Specifies the command or program to start. parameters Specifies parameters to pass to the command or program. When command extensions are enabled (the default setting in Windows 2000), external command invocation through the command line or the start command changes as follows:

Page 76: W2K Cmd Line

Windows 2000 Command Line

Page 76 of 101

• Nonexecutable files may be invoked through their file association just by typing the name of the file as a command.

For example, word.doc would open the application associated with the .doc file extension. Click assoc and ftype in

the list for information on creating these associations from within a command script. • When executing an application that is a 32-bit GUI application, cmd does not wait for the application to terminate

before returning to the command prompt. This new behavior does not occur if executing within a command script. • When executing a command line whose first token is the string "CMD" without an extension or path qualifier, then

"CMD" is replaced with the value of the COMSPEC variable. This prevents picking up cmd from the current directory. • When executing a command line whose first token does not contain an extension, then CMD.EXE uses the value of

the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is:

.COM;.EXE;.BAT;.CMD

Note

• The syntax is the same as the PATH variable, with semicolons separating the different elements. • When searching for an executable, if there is no match on any extension, then looks to see if the name matches a

directory name. If it does, the start command opens Windows Explorer on that path. If done from the command line, it is the equivalent to using the cd /d command to that path.

Subst Associates a path with a drive letter. subst [drive1: [drive2:]path] subst drive1: /d Parameters none Used without parameters, subst displays the names of the virtual drives in effect. drive1: Specifies the virtual drive to which you want to assign a path. drive2: Specifies the physical drive that contains the specified path (if different from the current drive). path Specifies the path that you want to assign to a virtual drive. /d Deletes a virtual drive.

Switches Forces an enhanced keyboard to behave like a conventional keyboard. You use this command in your Config.nt file. switches=/k

Tcmsetup Sets up the telephony client. Use tcmsetup to specify the remote servers used by a telephony client or to disable the client. tcmsetup [/q] [/x] /c server1 [server2 ... serverN] tcmsetup [/q] /c /d Parameters /q Prevents display of message boxes. /x Specifies connection-oriented callbacks for heavy traffic networks where packet loss is high. The default when this parameter is omitted is connectionless callbacks. /c Required parameter that specifies client setup. server1 The remote server name where this client will use TAPI service providers and their lines or phones. The client must be in the same domain as the server or in a domain that has a two-way trust relationship with the domain containing the server. server2 ... serverN Any additional servers to be used that are available to this client. /d Clears the list of remote servers. Disables the telephony client by preventing it from using the TAPI service providers on the remote servers. Notes

• You must be in the administrators group to run this command. If you are logged on in another group, see Use the Run as command to start a program as an administrator.

Page 77: W2K Cmd Line

Windows 2000 Command Line

Page 77 of 101

• Before a client user can use a phone or line on a TAPI server, the telephony server administrator must assign the user to the phone or line.

• The list of telephony servers created by this command replaces any existing list of telephony servers available to the client. You cannot use this command to add to the existing list.

TCP/IP Utilities and Services To get more information, select a utility or service. TCP/IP Utilities

arp nslookup finger ping ftp rcp hostname rexec ipconfig route lpq rsh lpr tftp nbtstat tracert netstat TCP/IP Services

net start dhcp client net start simple tcp/ip services net start ftp publishing service net start snmp net start lpdsvc net start tcp/ip netbios helper net start microsoft dhcp service net start windows internet name service The TCP/IP utilities offer network connections to non-Microsoft computers such as UNIX workstations. You must have the TCP/IP network protocol installed to use the TCP/IP utilities.

Tftp Transfers files to and from a remote computer running the TFTP service. This command is available only if the TCP/IP protocol has been installed. tftp [-i] computer [get | put] source [destination] Parameters -i Specifies binary image transfer mode (also called octet). In binary image mode, the file is moved literally, byte by byte. Use this mode when transferring binary files. If -i is omitted, the file is transferred in ASCII mode. This is the default transfer mode. This mode converts the EOL characters to a carriage return for UNIX and a carriage return/line feed for personal computers. This mode should be used when transferring text files. If a file transfer is successful, the data transfer rate is displayed. computer Specifies the local or remote computer. put Transfers the file destination on the local computer to the file source on the remote computer. get Transfers the file destination on the remote computer to the file source on the local computer. Specify put if transferring file file-two on the local computer to file file-one on remote computer. Specify get if transferring file file-two on the remote computer to file file-one on the remote computer. Since the tftp protocol does not support user authentication, the user must be logged on, and the files must be writable on the remote computer. source Specifies the file to transfer. If the local file is specified as -, the remote file is printed out on stdout (if getting), or is read from stdin (if putting). destination Specifies where to transfer the file. If destination is omitted, it is assumed to have the same name as source.

Time Displays the system time or sets your computer's internal clock. time [hours:[minutes[:seconds[.hundredths]]][A|P]] Parameters none Used without parameters, time displays the computer's clock time and prompts for the new time. Press ENTER to leave the time unchanged or type the new time using the syntax above. hours Specifies the hour. Valid values are in the range 0 through 23. minutes

Page 78: W2K Cmd Line

Windows 2000 Command Line

Page 78 of 101

Specifies minutes. Valid values are in the range 0 through 59. seconds Specifies seconds. Valid values are in the range 0 through 59. hundredths Specifies hundredths of a second. Valid values are in the range 0 through 99. A|P Specifies A.M or P.M. for the 12-hour time format. If you type a valid 12-hour time but do not type A or P, time uses A for A.M.

Title Creates a title for the command prompt window. title [string] Parameter string Specifies the title for the command prompt window.

Tracert This diagnostic utility determines the route taken to a destination by sending Internet Control Message Protocol (ICMP) echo packets with varying Time-To-Live (TTL) values to the destination. Each router along the path is required to decrement the TTL on a packet by at least 1 before forwarding it, so the TTL is effectively a hop count. When the TTL on a packet reaches 0, the router is supposed to send back an ICMP Time Exceeded message to the source system. Tracert determines the route by sending the first echo packet with a TTL of 1 and incrementing the TTL by 1 on each subsequent transmission until the target responds or the maximum TTL is reached. The route is determined by examining the ICMP Time Exceeded messages sent back by intermediate routers. However, some routers silently drop packets with expired TTL values and are invisible to tracert. tracert [-d] [-h maximum_hops] [-j computer-list] [-w timeout] target_name Parameters -d Specifies not to resolve addresses to computer names. -h maximum_hops Specifies maximum number of hops to search for target. -j computer-list Specifies loose source route along computer-list. -w timeout Waits the number of milliseconds specified by timeout for each reply. target_name Name of the target computer.

Tree Graphically displays the directory structure of a path or of the disk in a drive. tree [drive:][path] [/f] [/a] Parameters drive: Specifies the drive that contains the disk for which you want to display the directory structure. path Specifies the directory for which you want to display the directory structure. /f Displays the names of the files in each directory. /a Specifies that tree is to use text characters instead of graphic characters to show the lines linking subdirectories.

Type Displays the contents of a text file. Use the type command to view a text file without modifying it. type [drive:][path] filename Parameter [drive:][path] filename Specifies the location and name of the file or files that you want to view. Separate multiple file names with spaces. If using an NTFS drive, and the file name contains spaces, you must enclose the file name with quotation marks (").

Ver Displays the Windows 2000 version number. ver

Verify Windows 2000 does not use this command. It is accepted only for compatibility with MS-DOS files.

Page 79: W2K Cmd Line

Windows 2000 Command Line

Page 79 of 101

Vol Displays the disk volume label and serial number, if they exist. A serial number is displayed for a disk formatted with MS-DOS version 4.0 or later. vol [drive:] Parameter drive: Specifies the drive that contains the disk for which you want to display the volume label and serial number.

Winnt Performs an installation of or upgrade to Windows 2000. winnt [/s:sourcepath] [/t:tempdrive] [/u:answer file][/udf:id [,UDB_file]] [/r:folder][/rx:folder][/e:command][/a] Parameters /s:sourcepath Specifies the source location of the Windows 2000 files. The location must be a full path of the form x:\[path] or \\server\share[\path]. /t:tempdrive Directs Setup to place temporary files on the specified drive and to install Windows 2000 on that drive. If you do not specify a location, Setup attempts to locate a drive for you. /u:answer file Performs an unattended Setup using an answer file. The answer file provides answers to some or all of the prompts that the end user normally responds to during Setup. You must also use /s. /udf:id [,UDB_file] Indicates an identifier ( id) that Setup uses to specify how a Uniqueness Database (UDB) file modifies an answer file (see /u). The /udf parameter overrides values in the answer file, and the identifier determines which values in the UDB file are used. If no UDB_file is specified, Setup prompts you to insert a disk that contains the $Unique$.udb file. /r:folder Specifies an optional folder to be installed. The folder remains after Setup finishes. /rx:folder Specifies an optional folder to be copied. The folder is deleted after Setup finishes. /e:command Specifies a command to be executed at the end of GUI-mode Setup. /a Enables accessibility options.

Page 80: W2K Cmd Line

Windows 2000 Command Line

Page 80 of 101

Winnt32 Sets up or upgrades Windows 2000 Server or Windows 2000 Professional. You can run the winnt32 command at a Windows 95, Windows 98, or Windows NT command prompt. winnt32 [/s:sourcepath] [/tempdrive:drive_letter] [/unattend[num]:[answer_file]] [/copydir:folder_name] [/copysource:folder_name] [/cmd:command_line] [/debug[level]:[filename]] [/udf:id[,UDF_file]] [/syspart:drive_letter] [/checkupgradeonly] [/cmdcons] [/m:folder_name] [makelocalsource] [/noreboot] Parameters /s:sourcepath Specifies the source location of the Windows 2000 files. To simultaneously copy files from multiple servers, specify multiple /s sources. If you use multiple /s switches, the first specified server must be available or Setup will fail. /tempdrive:drive_letter Directs Setup to place temporary files on the specified partition and to install Windows 2000 on that partition. /unattend Upgrades your previous version of Windows 2000, Windows NT 4.0, Windows 3.51, Windows 95, or Windows 98 in unattended Setup mode. All user settings are taken from the previous installation, so no user intervention is required during Setup. Using the /unattend switch to automate Setup affirms that you have read and accepted the Microsoft License Agreement for Windows 2000. Before using this switch to install Windows 2000 on behalf of an organization other than your own, you must confirm that the end user (whether an individual, or a single entity) has received, read, and accepted the terms of the Windows 2000 Microsoft License Agreement. OEMs may not specify this key on machines being sold to end users. /unattend[num]:[answer_file] Performs a fresh installation in unattended Setup mode. The answer file provides Setup with your custom specifications. Num is the number of seconds between the time that Setup finishes copying the files and when it restarts your computer. You can use num on any computer running Windows NT or Windows 2000. Answer_file is the name of the answer file. /copydir:folder_name Creates an additional folder within the folder in which the Windows 2000 files are installed. For example, if the source folder contains a folder called Private_drivers that has modifications just for your site, you can type /copydir:Private_drivers to have Setup copy that folder to your installed Windows 2000 folder, making the new folder location C:\Winnt\Private_drivers. You can use /copydir to create as many additional folders as you want. /copysource:folder_name Creates a temporary additional folder within the folder in which the Windows 2000 files are installed. For example, if the source folder contains a folder called Private_drivers that has modifications just for your site, you can type /copysource:Private_drivers to have Setup copy that folder to your installed Windows 2000 folder and use its files during Setup, making the temporary folder location C:\Winnt\Private_drivers. Unlike the folders /copydir creates, /copysource folders are deleted after Setup completes. /cmd:command_line Instructs Setup to carry out a specific command before the final phase of Setup. This would occur after your computer has restarted twice and after Setup has collected the necessary configuration information, but before Setup is complete. /debug[level]:[filename] Creates a debug log at the level specified, for example, /debug4:C:\Win2000.log. The default log file is C:\%Windir%\Winnt32.log, with the debug level set to 2. The log levels are as follows: 0-severe errors, 1-errors, 2-warnings, 3-information, and 4-detailed information for debugging. Each level includes the levels below it. /udf:id[,UDB_file] Indicates an identifier ( id) that Setup uses to specify how a Uniqueness Database (UDB) file modifies an answer file (see the /unattend entry). The /udf parameter overrides values in the answer file, and the identifier determines which values in the UDB file are used. For example, /udf:RAS_user,Our_company.udb overrides settings specified for the RAS_user identifier in the Our_company.udb file. If no UDB_file is specified, Setup prompts the user to insert a disk that contains the $Unique$.udb file. /syspart:drive_letter Specifies that you can copy Setup startup f iles to a hard disk, mark the disk as active, and then install the disk into another computer. When you start that computer, it automatically starts with the next phase of the Setup. You must always use the /tempdrive parameter with the /syspart parameter. /checkupgradeonly Checks your computer for upgrade compatibility with Windows 2000. For Windows 95 or Windows 98 upgrades, Setup creates a report named Upgrade.txt in the Windows installation folder. For Windows NT 3.51 or 4.0 upgrades, it saves the report to the Winnt32.log in the installation folder. /cmdcons Adds to the operating system selection screen a Recovery Console option for repairing a failed installation. It is only used post-Setup. /m:folder_name Specifies that Setup copies replacement files from an alternate location. Instructs Setup to look in the alternate location first and if files are present, use them instead of the files from the default location. /makelocalsource Instructs Setup to copy all installation source files to your local hard disk. Use /makelocalsource when installing from a CD to provide installation files when the CD is not available later in the installation. /noreboot Instructs Setup to not restart the computer after the file copy phase of winnt32 is completed so that you can execute another command.

Page 81: W2K Cmd Line

Windows 2000 Command Line

Page 81 of 101

Xcopy Copies files and directories, including subdirectories. xcopy source [destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/d[:date]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [/a|/m] [/n] [/exclude:filename] [/y | /-y] [/z] Parameters source Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path. destination Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination. /w Displays the following message and waits for your response before starting to copy files:

Press any key to begin copying file(s) /p Prompts you to confirm whether you want to create each destination file. /c Ignores errors. /v Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files. This switch is ignored because the functionality is inherent to the Windows 2000 operating system. The switch is accepted only for compatibility with previous versions of MS-DOS. /q Suppresses display of xcopy messages. /f Displays source and destination file names while copying. /l Does not copy files, only displays (lists) files that would be copied. /d[:date] Copies only source files changed on or after the specified date. If the date value is missing, xcopy copies all source files that are newer than the time of existing destination files. This option allows you to update only files that have changed. If you specify a date, use a hyphen (-) as the separator rather than a forward slash (/) so that the date is not interpreted as another parameter. /u Copies (updates) only files from source that exist on destination. /i If source is a directory or contains wildcards, and destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory then copies all specified files into the new directory. By default, xcopy will prompt you to specify whether destination is a file or directory. /s Copies directories and subdirectories, unless they are empty. If you omit this switch, xcopy works within a single directory. /e Copies all subdirectories, even if they are empty. Used with the /s and /t switches. /t Copies only subdirectory structure (tree), not files. To copy empty directories, you must include the /e switch. /k Copies files and retains the read-only attribute on destination files if present on the source files. By default, the read-only attribute is removed. /r Copies over read-only files. /h Copies files with the hidden and system file attributes. The xcopy command does not copy hidden or system files by default. /a Copies only source files that have their archive file attributes set. This switch does not modify the archive file attribute of the source file. For information about how to set the archive file attribute, see the attrib command. /m Copies source files that have their archive file attributes set. Unlike the /a switch, the /m switch turns off archive file attributes in the files specified in source. For information about how to set the archive file attribute, click attrib in the list[JG1]. /n Copies using NTFS short file or directory names. This switch is required when copying files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (8.3) is required on the destination volume. The destination file system may be FAT or NTFS. /exclude:filename Excludes the files listed in the specified file from the copy operation. The exclusion file can have a list of exclusion patterns (one per line, no wildcard characters are supported). If any exclusion pattern in the file matches any part of the path of a subject file, that file is not copied. /y Suppresses prompting to confirm you want to overwrite an existing destination file. The /y switch may be preset in the COPYCMD environment variable. This may be overridden with /-y on the command line. The default is to prompt on overwrites unless the copy command is being executed from within a batch script. To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format).

Page 82: W2K Cmd Line

Windows 2000 Command Line

Page 82 of 101

/-y Causes prompting to confirm you want to overwrite an existing destination file. /z Copies over a network in restartable mode. If the connection is lost during the copy phase (for example, if the server going offline severs the connection), it will resume after the connection has been re-established. Using this command switch also displays the percentage of the copy operation completed for each file.

Page 83: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 83 of 101

Appendix A – Recovery Console

Recovery Console overview The Windows 2000 Recovery Console is a command-line console that you can start from the Windows 2000 Setup program. Using the Recovery Console, you can start and stop services, format drives, read and write data on a local drive (including drives formatted to use NTFS), and perform many other administrative tasks. The Recovery Console is particularly useful if you need to repair your system by copying a file from a floppy disk or CD-ROM to your hard drive, or if you need to reconfigure a service that is preventing your computer from starting properly. Because the Recovery Console is quite powerful, it should only be used by advanced users who have a thorough knowledge of Windows 2000. In addition, you must be an administrator to use the Recovery Console. There are two ways to start the Recovery Console:

• If you are unable to start your computer, you can run the Recovery Console from your Windows 2000 Setup disks or from the Windows 2000 Professional CD (if you can start your computer from your CD-ROM drive).

• As an alternative, you can install the Recovery Console on your computer to make it available in case you are unable to restart Windows 2000. You can then select the Recovery Console option from the list of available operating systems.

After you start the Recovery Console you will have to choose which drive you want to log on to (if you have a dual-boot or multiple-boot system) and you will have to log on with your administrator password. For information on starting and using the Recovery Console, see . In addition, if you are using Windows 2000 Professional, see

the Windows 2000 Professional Getting Started online book, or the Windows 2000 Professional Getting Started book that came with your Windows 2000 CD. If you are using Windows 2000 Server, see the Disaster Recovery How to section. Once you are running the Recovery Console, you can get help on the available commands by typing help at the command prompt.

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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The attrib command with different parameters is available from the command prompt in Windows 2000. 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.

Page 84: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 84 of 101

Batch Executes the commands specified in a text file. The batch command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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

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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The chdir command with different parameters is available from the command prompt in Windows 2000. 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. Chkdsk also lists and corrects errors on the disk. The chkdsk command with the parameters listed below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The chkdsk command with different parameters is available from the command prompt in Windows 2000. 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.

Page 85: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 85 of 101

Note

• Chkdsk requires the file Autochk.exe. If it cannot find it in the startup directory (\Winnt\System32, by default), it will attempt to locate it on the Windows 2000 Installation CD. If you have a multi-boot computer, be sure you are issuing this command from the drive containing Windows 2000.

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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The copy command with different parameters is available from the command prompt in Windows 2000. 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. Notes

• 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 l isted below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The delete or del command with different parameters is available from the command prompt in Windows 2000. 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.

Page 86: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 86 of 101

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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The dir command with different parameters is available from the command prompt in Windows 2000. 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 2000 or Windows NT 4.0 system service or a device driver. The disable command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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 2000 starts.

Page 87: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 87 of 101

Diskpart Creates and deletes partitions on a hard drive. The diskpart command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. diskpart [/add | /delete] [device_name | drive_name | partition_name] [size] Parameters none Used without parameters, the diskpart command starts the Windows 2000 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 2000 or Windows NT 4.0 system service or a device driver. The enable command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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. 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.

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

• 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 Windows 2000 Recovery Console and restarts your computer. The exit command is available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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 on the Windows 2000 CD.

Page 88: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 88 of 101

The expand command with the parameters listed below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The expand command with different parameters is available from the command prompt in Windows 2000. expand [/d] [/y] source | source.cab [/F:filespec}] [destination] Parameters /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. 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. source.cab /f:filespec Specifies a cabinet file to extract from, and the name of the file or files you want to extract. Use this if the source file contains multiple files. You can use wildcards for the files you want to extract. destination Specifies the destination directory and/or file name for the extracted file. Examples The following example extracts the file Msgame.sys from the Drivers cabinet file on the Windows 2000 CD and copies it to C:\Winnt\System\Drivers: expand d:\i386\driver.cab \f:msgame.sys c:\winnt\system\drivers The following example expands the compressed file Access.cp_: expand d:\i386\acces.cp_ c:\winnt\system32\access.cpl The following example lists all the files in the Drivers cabinet file on the Windows 2000 CD: expand /d d:\i386\driver.cab Important

• The Driver cabinet file, which contains most of the drivers provided by Windows 2000, 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 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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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 Writes a new master boot record to a hard drive. The fixmbr command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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

Page 89: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 89 of 101

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 for use with Windows 2000. The format command with the parameters listed below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The format command with different parameters is available from the command prompt in Windows 2000. 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 Windows 2000 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 /?

Page 90: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 90 of 101

Recovery Console commands The following commands can be used with the Windows 2000 Recovery Console:

• Attrib

• Changes the attributes of a file or directory.

• Batch

• Executes the commands specified in the text file.

• ChDir (Cd)

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

• Chkdsk

• Checks a disk and displays a status report.

• Cls

• Clears the screen.

• Copy

• Copies a single file to another location.

• Delete (Del)

• Deletes one or more files.

• Dir

• Displays a list of files and subdirectories in a directory.

• Disable

• Disables a system service or a device driver.

• Diskpart

• Manages partitions on your hard drives.

• Enable

• Starts or enables a system service or a device driver.

• Exit

• Exits the Recovery Console and restarts your computer.

• Expand

• Extracts a file from a compressed file.

• Fixboot

• Writes a new partition boot sector onto the system partition.

• Fixmbr

• Repairs the master boot record of the partition boot sector.

• Format

• Formats a disk.

• Help

• Displays a list of the commands you can use in the Recovery Console.

• Listsvc

• Lists the services and drivers available on the computer.

• Logon

• Logs on to a Windows 2000 installation.

• Map

• Displays the drive letter mappings.

• Mkdir (Md)

• Creates a directory.

• More

• Displays a text file.

Page 91: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 91 of 101

• Rename (Ren)

• Renames a single file.

• Rmdir (Rd)

• Deletes a directory.

• Set

• Displays and sets environment variables.

• Systemroot

• Sets the current directory to the systemroot directory of the system you are currently logged on to.

• Type

Displays a text file.

Additional information on starting and using the Recovery Console is available. If you are using Windows 2000 Professional,

see the Windows 2000 Professional Getting Started online book, or the Windows 2000 Professional Getting Started book that came with your Windows 2000 CD. If you are using Windows 2000 Server, see the Disaster Recovery How to section.

Listsvc Lists the services and drivers available on the computer. The listsvc command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. listsvc Parameters none

Logon Logs you on to an installation of Windows 2000 or Windows NT 4.0. The logon command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. logon Parameters none Note

• The logon command will list all detected installations of Windows 2000 and Windows NT, and request the local administrator password for that installation to log you on.

Map Displays a mapping of drive letters to physical device names. This information is useful when you run the fixboot, fixmbr, or fdisk commands. The map command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. Map [arc] Parameter arc Instructs the map command to display Advanced RISC Computing (ARC) device names instead of Windows 2000 device names. An example of an ARC device name is: multi(0)disk(0)rdisk(0)partition(1) The equivalent Windows 2000 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 Windows 2000 device names. • The map command also displays the type of file system and the size of each disk in megabytes (MB).

Mkdir (Md)

Page 92: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 92 of 101

Creates a directory or subdirectory. The mkdir command with the parameters listed below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The mkdir command with different parameters is available from the command prompt in Windows 2000. 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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The more command with different parameters is available from the command prompt in Windows 2000. 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 (").

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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The rename command with different parameters is available from the command prompt in Windows 2000. 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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The rmdir command with different parameters is available from the command prompt in Windows 2000. 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 enabled with Security Templates. The set command with the parameters listed below is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The set command with different parameters is available from the command prompt in Windows 2000. set [variable=[string]] Parameters none Used without parameters, set displays the current environment settings. variable

Page 93: W2K Cmd Line

Appendix A - Recovery Console - Windows 2000 Command Line

Page 93 of 101

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

• 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 2000 installation you are logged on to. The systemroot command is only available when you are using the Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. 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 Windows 2000 Recovery Console, which can be started from the Windows 2000 Setup program. The type command with different parameters is available from the command prompt in Windows 2000. 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.

Page 94: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 94 of 101

Appendix B – NTDSutil (Directory Services Restore Mode) ntdsutil: help ? - Print this help information Authoritative restore - Authoritatively restore the DIT database Domain management - Prepare for new domain creation Files - Manage NTDS database files Help - Print this help information IPDeny List - Manage LDAP IP Deny List LDAP policies - Manage LDAP protocol policies Metadata cleanup - Clean up objects of decommissioned servers Popups %s - (en/dis)able popups with "on" or "off" Quit - Quit the utility Roles - Manage NTDS role owner tokens Security account management - Manage Security Account Database - Duplicate SID Cleanup Semantic database analysis - Semantic Checker ntdsutil: authoritative restore authoritative restore: help ? - Print this help information Help - Print this help information Quit - Return to the prior menu Restore database - Authoritatively restore entire database Restore database verinc %d - ... and override version increase Restore subtree %s - Authoritatively restore a subtree Restore subtree %s verinc %d - ... and override version increase authoritative restore: quit ntdsutil: domain management domain management: help ? - Print this help information Connections - Connect to a specific domain controller Help - Print this help information List - List known Naming Contexts Precreate %s %s - Precreate CR for domain %s1 (a DN) allowing server %s2

(a full DNS name) to dcpromo Quit - Return to the prior menu Select operation target - Select sites, servers, domains, roles and Naming Contexts domain management: quit ntdsutil: files file maintenance: help ? - Print this help information Compact to %s - Compact DB to specified directory Header - Dump the Jet database header Help - Print this help information Info - Return information about DS files Integrity - Perform Jet integrity check Move DB to %s - Move DB to specified directory Move logs to %s - Move log files to specified directory Quit - Return to the prior menu Recover - Perform soft database recovery Repair - Perform database repair - YOU CAN LOSE DATA Set path backup %s - Set online backup directory path Set path DB %s - Set DB file path Set path logs %s - Set logging directory path Set path working dir %s - Set NTDS working directory path file maintenance: quit

Page 95: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 95 of 101

ntdsutil: IPDeny List IP Deny List: help ? - Print this help information Add %s %s - Add IP adress as <Address> <Mask>

Use "NODE" as mask for single node. Examples: add 172.32.12.34 NODE add 172.34.44.0 255.255.255.0

Cancel - Cancel the changes made Commit - Commit the changes made to the server Connections - Connect to a specific domain controller Delete %d - Delete an entry with given index. Help - Print this help information Quit - Return to the prior menu Show - Show current list of IP addresses on list Test %s - Test an IP address against the current list IP Deny List: quit ntdsutil: LDAP policies ldap policy: help ? - Print this help information Cancel Changes - Cancel the changes made Commit Changes - Commit the changes made to the server Connections - Connect to a specific domain controller Help - Print this help information List - Lists supported policies on the server Quit - Return to the prior menu Set %s to %s - Sets the policy value Show Values - Show values of policies ldap policy: quit ntdsutil: metadata cleanup metadata cleanup: help ? - Print this help information Connections - Connect to a specific domain controller Help - Print this help information Quit - Return to the prior menu Remove selected domain - Remove DS objects for selected domain Remove selected Naming Context - Remove DS objects for selected Naming Context Remove selected server - Remove DS objects for selected server Select operation target - Select sites, servers, domains, roles and Naming Contexts metadata cleanup: quit ntdsutil: roles fsmo maintenance: help ? - Print this help information Connections - Connect to a specific domain controller Help - Print this help information Quit - Return to the prior menu Seize domain naming master - Overwrite domain role on connected server Seize infrastructure master - Overwrite infrastructure role on connected server Seize PDC - Overwrite PDC role on connected server Seize RID master - Overwrite RID role on connected server Seize schema master - Overwrite schema role on connected server Select operation target - Select sites, servers, domains, roles and Naming Contexts Transfer domain naming master - Make connected server the domain naming master Transfer infrastructure master - Make connected server the infrastructure master Transfer PDC - Make connected server the PDC Transfer RID master - Make connected server the RID master Transfer schema master - Make connected server the schema master fsmo maintenance: quit

Page 96: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 96 of 101

ntdsutil: security account management Security Account Maintenance: help ? - Print this help information Check Duplicate SID

- Check SAM database for any duplicate SID. Won't Clean them

Cleanup Duplicate SID - Check SAM database for any duplicate SID and Clean them up Connect to server %s - Connect to server, Net Bios Name or DNS host name Help - Print this help information Log File %s - Specify log file name, otherwise the default is dupsid.log Quit - Return to the prior menu Security Account Maintenance: quit ntdsutil: semantic database analysis semantic checker: help ? - Print this help information Get %d - Get record info with given DNT Go - Start Semantic Checker With No Fixup Go Fixup - Start Semantic Checker with Help - Print this help information Quit - Return to the prior menu Verbose %s - Turn verbose mode on/off semantic checker: quit

Authoritative restore In Backup, distributed services such as the Active Directory directory service are contained in a collection known as the System State data. When you back up the System State data on a domain controller, you are backing up all Active Directory data that exists on that server (along with other system components such as the SYSVOL directory and the registry). In order to restore these distributed services to that server, you must restore the System State data. However, if you have more than one domain controller in your organization, and your Active Directory is replicated to any of these other servers, you will need to perform what is called an authoritative restore in order to ensure that your restored data gets replicated to all of your servers. During a normal restore operation, Backup operates in nonauthoritative restore mode. That is, any data that you restore, including Active Directory objects, will have their original update sequence number. The Active Directory replication system uses this number to detect and propagate Active Directory changes among the servers in your organization. Because of this, any data that is restored nonauthoritatively will appear to the Active Directory replication system as though it is old, which means the data will never get replicated to your other servers. Instead, the Active Directory replication system will actually update the restored data with newer data from your other servers. Authoritative restore solves this problem. To authoritatively restore Active Directory data, you need to run the Ntdsutil utility after you have restored the System State data but before you restart the server. The Ntdsutil utility lets you mark Active Directory objects for authoritative restore. When an object is marked for authoritative restore its update sequence number is changed so that it is higher than any other update sequence number in the Active Directory replication system. This will ensure that any replicated or distributed data that you restore is properly replicated or distributed throughout your organization. For example, if you inadvertently delete or modify objects stored in the Active Directory directory service, and those objects are replicated or distributed to other servers, you will need to authoritatively restore those objects so they are replicated or distributed to the other servers. If you do not authoritatively restore the objects, they will never get replicated or distributed to your other servers because they will appear to be older than the objects currently on your other servers. Using the Ntdsutil utility to mark objects for authoritative restore ensures that the data you want to restore gets replicated or distributed throughout your organization. On the other hand, if your system disk has failed or the Active Directory database is corrupted, then you can simply restore the data nonauthoritatively without using the Ntdsutil utility. The Ntdsutil command line utility can be run from the command prompt. Help for the Ntdsutil utility can also be found at the command prompt by typing ntdsutil /?.

Caution

• When you restore the System State data, and you do not designate an alternate location for the data, Backup will erase the System State data that is currently on your computer and replace it with the System State data you are restoring.

Notes

• You must be an administrator or a backup operator to back up files and folders. For more information on permissions or user rights, see...

• In order to restore the System State data on a domain controller, you must first start your computer in directory services restore mode. This will allow you to restore the SYSVOL directory and the Active Directory. For more information on starting your computer in safe mode, see .

Page 97: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 97 of 101

• You can only restore the System State data on a local computer. You cannot restore the System State data on a remote computer.

System State data You can back up and restore the following system components using Backup:

• Registry • COM+ Class Registration database • Boot files, including the system files • Certificate Services database • Active Directory directory service • SYSVOL directory • Cluster service information

Backup refers to these system components as the System State data. For Windows 2000 Professional, the System State data comprises only the registry, COM+ Class Registration database, and boot files. For Windows 2000 Server operating systems, the System State data comprises the registry, COM+ Class Registration database, system boot files, and the Certificate Services database (if the server is a certificate server). If the server is a domain controller, Active Directory and the SYSVOL directory are also contained in the System State data. Also, if you are running the domain name service (DNS) on a domain controller, then the Active Directory portion of the System State data also contains all of the DNS zone information (DS integrated and non-DS integrated). Finally, if the server is running the Cluster service, then the System State data will also include any resource registry checkpoints and the quorum resource recovery log, which contains the most recent cluster database information. When you choose to back up or restore the System State data, all of the System State data that is relevant to your computer is backed up or restored; you cannot choose to back up or restore individual components of the System State data. This is due to dependencies among the System State components. However, you can restore the System State data to an alternate location. If you do this, only the registry files, SYSVOL directory files, Cluster database information files, and system boot files are restored to the alternate location. The Active Directory directory services database, Certificate Services database, and COM+ Class Registration database are not restored if you designate an alternate location when you restore the System State data. Furthermore, if you have more than one domain controller in your organization, and the Active Directory directory service is replicated to any of these other servers, you may have to authoritatively restore any Active Directory data that you want to restore. To do this, you need to run the Ntdsutil utility after you have restored the System State data but before you restart the server on the network. The Ntdsutil utility lets you mark Active Directory objects for authoritative restore. This will ensure that any replicated or distributed data that you restore is properly replicated or distributed throughout your organization. For example, if you inadvertently delete or modify objects stored in the Active Directory directory service, and those objects are replicated or distributed to other servers, you will need to authoritatively restore those objects so they are replicated or distributed to the other servers. If you do not authoritatively restore the objects, they will never get replicated or distributed to your other servers because they will appear to be older than the objects currently on your other servers. Using the Ntdsutil utility to mark objects for authoritative restore ensures that the data you want to restore gets replicated or distributed throughout your organization. On the other hand, if your system disk has failed or the Active Directory database is corrupted, then you can simply restore the data nonauthoritatively without using the Ntdsutil utility. The Ntdsutil command line utility can be run from the command prompt. Help for the Ntdsutil utility can also be found at the command prompt by typing ntdsutil /?.

Notes

• You must have certain permissions or user rights to back up files and folders. • In order to restore the System State data on a domain controller, you must first start your computer in directory

services restore mode. This will allow you to restore the SYSVOL directory and the Active Directory. • You can only back up and restore the System State data on a local computer. You cannot back up and restore the

System State data on a remote computer. • Although you can't change which components of the System State are backed up, you can back up all of the

protected system files with the System State data by setting advanced backup options. For more information, see .

Page 98: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 98 of 101

To restore System State data

1. Open Backup. 2. Click the Restore tab, and then in Click to select the check box for any drive, folder, or file that you want to

restore, click the box next to System State . This will restore the System State data along with any other data you have selected for the current restore operation.

Caution

• If you restore the System State data, and you do not designate an alternate location for the restored data, Backup will erase the System State data that is currently on your computer and replace it with the System State data you are restoring. Also, if you restore the System State data to an alternate location, only the registry files, SYSVOL directory files, Cluster database information files, and system boot files are restored to the alternate location. The Active Directory directory services database, Certificate Services database, and COM+ C lass Registration database are not restored if you designate an alternate location.

Notes

• You must be an administrator or a backup operator to restore files and folders. For more information on permissions or user rights, see .

• To start Backup, click Start, point to Programs, point to Accessories, point to System Tools, and then click Backup.

• If you are restoring data from a tape, you should update the on-disk catalog for the tape before you perform the restore operation. For more information on updating a catalog, see .

• You can also use the Restore wizard to restore the System State data by clicking Restore Wizard on the Tools menu.

• If you are restoring the System State data to a domain controller, you must choose whether you want to perform an authoritative restore or a nonauthoritative restore. The default method of restoring the System State data to a domain controller is nonauthoritative. In this mode, any component of the System State that is replicated with another domain controller, such as the Active Directory directory service or the File Replication service (including the SYSVOL directory), will be brought up to date by replication after you restore the data. For example, if the last backup was performed a week ago, and the System State is restored using the default restore method (nonauthoritative), any changes made subsequent to the backup operation will be replicated from the domain controllers.

In some cases, you may not want to replicate the changes that have been made subsequent to the last backup operation. In other words, there may be instances where you want all replicas to have the same state as the backed up data. To achieve this state, you must perform an authoritative restore.

For example, you have to perform an authoritative restore if you inadvertently delete users, groups, or organizational units from the Active Directory directory service, and you want to restore the system so that the deleted objects are recovered and replicated. To do this, you need to run the Ntdsutil utility after you have restored the data but before you restart the domain controller. This utility lets you mark objects as authoritative, which will ensure that any replicated or distributed data that you have restored is properly replicated or distributed throughout your organization. The Ntdsutil command line utility can be run from the command prompt. Help for the Ntdsutil utility can also be found at the command prompt by typing ntdsutil /?.

• In order to restore the System State data on a domain controller, you must first start your computer in a special safe mode called directory services restore mode. This will allow you to restore the SYSVOL directory and Active Directory directory service database. For more information on starting your computer in safe mode, see .

• You can only restore the System State data on a local computer. You cannot restore the System State data on a remote computer.

Page 99: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 99 of 101

To seize the domain naming master role

1. Click Start, click Run, and then type cmd. 2. At the command prompt, type ntdsutil. 3. At the ntdsutil prompt, type roles. 4. At the fsmo maintenance prompt, type connections. 5. At the server connections prompt, type connect to server, followed by the fully qualified domain name. 6. At the server connections prompt, type quit. 7. At the fsmo maintenance prompt, type seize domain naming master. 8. At the fsmo maintenance prompt, type quit. 9. At the ntdsutil prompt, type quit.

Caution

• Seizing the domain naming master is a drastic step that should be considered only if the current operations master will never be available again.

Note

• Before seizing the domain naming master, remove the current operations master from the network and verify that the new operations master is up to date. For more information about single master operations, see .

To seize the infrastructure master role

1. Click Start, click Run, and then type cmd. 2. At the command prompt, type ntdsutil. 3. At the ntdsutil prompt, type roles. 4. At the fsmo maintenance prompt, type connections. 5. At the server connections prompt, type connect to server, followed by the fully qualified domain name. 6. At the server connections prompt, type quit. 7. At the fsmo maintenance prompt, type seize infrastructure master. 8. At the fsmo maintenance prompt, type quit. 9. At the ntdsutil prompt, type quit.

Notes

• Before seizing the infrastructure master, remove the current operations master from the network and verify that the new operations master is up to date.

• When the original infrastructure master is returned to service, you can transfer the role back to the original domain controller. For more information about single master operations, see .

To seize the PDC emulator role

1. Click Start, click Run, and then type cmd. 2. At the command prompt, type ntdsutil. 3. At the ntdsutil prompt, type roles. 4. At the fsmo maintenance prompt, type connections. 5. At the server connections prompt, type connect to server, followed by the fully qualified domain name. 6. At the server connections prompt, type quit. 7. At the fsmo maintenance prompt, type seize PDC. 8. At the fsmo maintenance prompt, type quit. 9. At the ntdsutil prompt, type quit.

Notes

• Before seizing the PDC emulator master, remove the current operations master from the network and verify that the new operations master is up to date.

• When the original PDC emulator master is returned to service, you can return the role to the original domain controller. For more information about single master operations, see .

Page 100: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 100 of 101

To seize the relative ID master role

1. Click Start, click Run, and then type cmd. 2. At the command prompt, type ntdsutil. 3. At the ntdsutil prompt, type roles. 4. At the fsmo maintenance prompt, type connections. 5. At the server connections prompt, type connect to server, followed by the fully qualified domain name. 6. At the server connections prompt, type quit. 7. At the fsmo maintenance prompt, type seize RID master. 8. At the fsmo maintenance prompt, type quit. 9. At the ntdsutil prompt, type quit.

Caution

• Seizing the relative ID master is a drastic step that should be considered only if the current operations master will never be available again.

Note

• Before seizing the relative ID master, use Repadmin, in the Active Directory support tools, to verify whether the new operations master has received any updates performed by the previous role holder, and then remove the current operations master from the network. For more information about single master operations, and the Active Directory support tools, see .

To seize the schema master role

1. Click Start, click Run, and then type cmd. 2. At the command prompt, type ntdsutil. 3. At the ntdsutil prompt, type roles. 4. At the fsmo maintenance prompt, type connections. 5. At the server connections prompt, type connect to server, followed by the fully qualified domain name. 6. At the server connections prompt, type quit. 7. At the fsmo maintenance prompt, type seize schema master. 8. At the fsmo maintenance prompt, type quit. 9. At the ntdsutil prompt, type quit.

Caution

• Seizing the schema master is a drastic step that should be considered only if the current operations master will never be available again.

Note

• Before seizing the schema master, remove the current operations master from the network and verify that the copy of the schema on the new operations master is up to date with the rest of the domain controllers in the forest. For more information about single master operations, see .

Active Directory support tools Several additional tools that can be used to configure, manage and debug Active Directory are available as command line tools. These tools are known as the Support Tools and are available on the Windows 2000 Server compact disc in the \SUPPORT\TOOLS folder.

List and description of tools

Tool Description MoveTree Move objects from one domain to another. SIDWalker Set the access control lists on objects previously owned by accounts that were moved, orphaned, or deleted.

ESEUtil Repair, check, compact, move, and dump the directory database files. (Many of these functions are called by NTDSUTIL.)

Page 101: W2K Cmd Line

Appedix B – NTDSutil (Directory Services Restore Mode) - Windows 2000 Command Line

Page 101 of 101

NTDSUtil Repair, check, compact, move, and dump the directory database files. List site, domains and server information, manage operations masters, perform authoritative restore, create domains.

LDP Allows LDAP operations to be performed against Active Directory. This tool has a graphical user interface. DNSCMD Check dynamic registration of DNS resource records including Secure DNS update, as well as deregistration of

resource records. DOMMAP Check the replication topology and site and domain relationships. DSACLS View or modify the access control lists of directory objects. NETDOM5 Batch management of trusts, joining computers to domains, verifying trusts and secure channels. NETTest Check end to end network and distributed services functions. NLTest Check that the locator and secure channel are functioning. REPAdmin Check replication consistency between replication partners, monitor replication status, display replication

metadata, force replication events and knowledge consistency checker recalculation. REPLMon Display replication topology, monitor replication status (including group policies), force replication events and

knowledge consistency checker recalculation. This tool has a graphical user interface. DSAStat Compare directory information on domain controllers and detect differences. ADSIEdit A Microsoft Management Console (MMC) snap-in used to view all objects in the directory (including schema and

configuration information), modify objects and set access control lists on objects.

SDCheck Check access control list propagation and replication for specified objects in the directory. This tool enables an administrator to determine if access control lists are being inherited correctly and if access control list changes are being replicated from one domain controller to another.

ACLDiag Determine whether a user has been granted or denied access to a directory object. It can also be used to reset access control lists to their default state.

DFSCheck Command line utility for managing all aspects of Distributed File System (DFS), checking the configuration concurrency of DFS servers, and displaying the DFS topology.

For more information about the Active Directory support tools, see Windows 2000 Resource Kit.

These Windows 2000 Command Line Notes Compiled from Microsoft Sources by MikeTribe, June 2002

www.miketribe.com Legal Notice: These notes are only to be used as an aid to users with a fully licensed copy of a Microsoft Windows 2000Operating System. No liablitly for damage caused by inaccuracies will be accepted. If in doubt about the content held in these pages, please visit the Help pages in the appropriate operaring system or visit http://www.microsoft.com