| < Day Day Up > |
|
In this book, I’ve discussed many command-line tools and scripts. This appendix is intended to provide a quick reference to the syntax and usage of these tools as well as other commands and utilities that you may find helpful. These tools are listed alphabetically by tool name. Unless otherwise noted, these tools work the same on both Microsoft Windows Server 2003 and Windows XP Professional. In addition, if a tool is not included with the standard Windows installation, the source of the tool is listed, such as “Windows Server 2003 Resource Kit” for the tools available only through the Microsoft Windows Server 2003 Resource Kit.
ARP
Displays and modifies the IP-to-physical address translation tables used by the address resolution protocol (ARP).
arp -a [inet_addr] [-n if_addr]
arp -d inet_addr [if_addr]
arp -s inet_addr eth_addr [if_addr]
ASSOC
Displays and modifies file extension associations.
assoc [.ext[=[fileType]]]
ATTRIB
Displays and changes file attributes.
attrib [+r|-r] [+a|-a] [+s|-s] [+h|-h]
[[drive:] [path] filename] [/s] [/d]
CACLS
Displays and modifies a file’s access control list (ACL).
cacls filename [/t] [/e] [/c] [/g user:perm]
[/r user [...]] [/p user:perm [...]]
[/d user [...]]
CALL
Calls a script or script label as a procedure.
call [drive:][path]filename [batch-parameters]
call :label [args]
CD
Displays the name of or changes the current directory.
chdir [/d] [drive:][path]
chdir [..]
cd [/d] [drive:][path]
cd [..]
CHDIR
See CD.
CHKDSK
Checks a disk for errors and displays a report.
chkdsk [drive:][[path]filename]
[/f][/v][/r][/x][/i][/c][/l[:size]]
CHKNTFS
Displays the status of volumes. Sets or excludes volumes from automatic system checking when the computer is started.
chkntfs [/x | /c] volume: [...]
chkntfs /t[:time]
chkntfs /d
CHOICE
Creates a selection list from which users can select a choice in batch scripts.
choice [/c choices] [/n] [/cs] [/t nnnn /d choice] [/m "text"]
CIPHER
Displays current encryption status or modifies folder and file encryption on NTFS volumes.
In Windows Server 2003, use
cipher [/e| /d] [/s:dir] [/a] [/i] [/f] [/q]
[/h] [[path]filename [...]]
cipher [/k | /r:filename | w:dir]
cipher /u [/n]
cipher /x[:efsfile] [filename]
In Windows XP Professional, use
cipher [/e| /d] [/s:dir] [/a] [/i] [/f] [/q]
[/h] [[path]filename [...]]
cipher [/k | /r:filename | w:dir]
cipher /u [/n]
CLIP
With piping, redirects output of command-line tools to the Windows clipboard.
[command |] clip
Note | The symbol “|”, in this instance, is the pipe symbol. |
CLS
Clears the console window.
cls
CMD
Starts a new instance of the Windows command shell.
cmd [/a | /u] [/q] [/d] [/e:on | /e:off]
[/f:on | /f:off] [/v:on | /v:off]
[[/s] [/c | /k] string]
CMDKEY
Creates and manages stored user names and passwords.
cmdkey [{/add | /generic}:targetname
{/smartcard | /user:user@domain
{/pass{:pwd}}} | /delete{:targetname
| /ras} | /list{:targetname}]
This command applies only to Windows Server 2003.
COLOR
Sets the colors of the command-shell window.
color [bf]
COMP
Compares the contents of two files or sets of files.
comp [data1] [data2] [/d] [/a] [/l]
[/n=number] [/c] [/offline]
COMPACT
Displays or alters the compression of files on NTFS partitions.
compact [/c | /u] [/s[:dir]] [/a] [/i] [/f]
[/q] [filename [...]]
CONVERT
Converts FAT volumes to NTFS.
convert drive: /fs:NTFS [/v] [/x]
[/cvtarea:filename] [/nosecurity]
COPY
Copies or combines files.
copy [/d][/v][/n][/y|/-y][/z][/a|/b] source [/a | /b]
[+ source [/a | /b] [+ ...]][destination [/a|/b]]
DATE
Displays or sets the system date.
date [/T | mm-dd-yy]
DCGPOFIX
Restores default group policy objects.
dcgpofix [/ignoreschema]
[/target: {domain | dc | both}]
This command applies only to Windows Server 2003.
DEFRAG
Defragments hard drives.
defrag volume [/a] [/v]
defrag volume [/f]
DEL
Deletes one or more files.
del [/p] [/f] [/s] [/q] [/a[[:]attributes]]
[drive:][path]filename[...]
DIR
Displays a list of files and subdirectories within a directory.
dir [drive:][path][filename] [/p] [/w] [/d]
[/a[[:]attributes]] [/o[[:]sortorder]]
[/t[[:]timefield]] [/s] [/b] [/l] [/n]
[/x] [/c] [/q] [/4]
DISKCOMP
Compares the contents of two floppy disks.
diskcomp [drive1: [drive2:]]
DISKCOPY
Copies the contents of one floppy disk to another.
diskcopy [drive1: [drive2:]] [/v]
DISKPART
Invokes a text-mode command interpreter so that you can manage disks, partitions, and volumes using a separate command prompt and commands that are internal to DISKPART.
diskpart
Note | Techniques for working with DISKPART are covered in Chapter 8, “Configuring and Maintaining Hard Disk Drives,” Chapter 9, “Partitioning Basic Disks,” and Chapter 10, “Managing Volumes and RAID on Dynamic Disks.” |
DOSKEY
Edits command lines, recalls Windows commands, and creates macros.
doskey [/reinstall] [/listsize=size]
[/macros[:all | :exename]]
[/history] [/insert | /overstrike]
[/exename=exename]
[/macrofile=fname] [macroname=[text]]
DRIVERQUERY
Displays a list of all installed device drivers and their properties.
driverquery [/s computer [/u [domain\]user [/p [pwd]]]]
[/fo {table|list|csv}] [/nh] [/v] [/si]
DSADD COMPUTER
Creates a computer account in the Active Directory directory service.
dsadd computer ComputerDN [-samid SAMName] [-desc Description]
[-loc Location] [-memberof GroupDN ...] [{-s Server | -d Domain}]
[-u UserName] [-p {Password | *}] [-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSADD GROUP
Creates a group account in Active Directory.
dsadd group GroupDN [-secgrp {yes | no}] [-scope {l | g | u}] [-samid SAMName] [-desc Description] [-memberof Group ...] [-members Member
...] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}]
[-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSADD USER
Creates a user account in Active Directory.
dsadd user UserDN [-samid SAMName] [-upn UPN] [-fn FirstName] [-mi Initial] [-ln LastName] [-display DisplayName] [-empid EmployeeID]
[-pwd {Password | *}] [-desc Description] [-memberof Group ...]
[-office Office] [-tel PhoneNumber] [-email EmailAddress] [-hometel HomePhoneNumber] [- pager PagerNumber] [-mobile CellPhoneNumber]
[-fax FaxNumber] [-iptel IPPhoneNumber] [-webpg WebPage] [-title Title] [-dept Department] [-company Company] [-mgr Manager] [-hmdir HomeDirectory] [-hmdrv DriveLetter:] [-profile ProfilePath]
[-loscr ScriptPath] [-mustchpwd {yes | no}] [-canchpwd {yes | no}]
[-reversiblepwd {yes | no}] [- pwdneverexpires {yes | no}]
[-acctexpires NumberOfDays] [-disabled {yes | no}] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSGET COMPUTER
Displays the properties of a computer account using one of two syntaxes. The syntax for viewing the properties of multiple computers is
dsget computer ComputerDN ... [-dn] [-samid] [-sid] [-desc] [-loc]
[-disabled] [{-s Server | -d Domain}] [-u UserName] [-p {Password |
*}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-part PartitionDN
[-qlimit] [-qused]]
The syntax for viewing the membership information of a single computer is
dsget computer ComputerDN [-memberof [-expand]] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-c] [-q] [-l] [{-uc |
-uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSGET GROUP
Displays the properties of group accounts using one of two syntaxes. The syntax for viewing the properties of multiple groups is
dsget group GroupDN ... [-dn] [-samid] [-sid] [-desc] [-secgrp]
[-scope] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}]
[-c] [-q] [-l] [{-uc | -uco | - uci}] [-part PartitionDN [-qlimit]
[-qused]]
The syntax for viewing the group membership information for an individual group is
dsget group GroupDN [{-memberof | -members} [-expand]] [{-s Server
| -d Domain}] [-u UserName] [-p {Password | *}] [-c] [-q] [-l]
[{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSGET SERVER
Displays the various properties of domain controllers using any of three syntaxes. The syntax for displaying the general properties of a specified domain controller is:
dsget server ServerDN ... [-dn] [-desc] [-dnsname] [-site] [-isgc]
[{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-c]
[-q] [-l] [{-uc | -uco | -uci}]
The syntax for displaying a list of the security principals who own the largest number of directory objects on the specified domain controller is
dsget server ServerDN [{-s Server | -d Domain}] [-u UserName]
[-p {Password | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]
[-topobjowner NumbertoDisplay]
The syntax for displaying the distinguished names of the directory partitions on the specified server is
dsget server ServerDN [{-s Server | -d Domain}] [-u UserName]
[-p {Password | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-part]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSGET USER
Displays the properties of user accounts using one of two syntaxes. The syntax for viewing the properties of multiple users is
dsget user UserDN ... [-dn] [-samid] [-sid] [-upn] [-fn] [-mi] [-ln]
[-display] [-empid] [-desc] [-office] [-tel] [-email] [-hometel]
[-pager] [-mobile] [-fax] [-iptel] [-webpg] [-title] [-dept]
[-company] [-mgr] [-hmdir] [-hmdrv] [-profile] [-loscr] [-mustchpwd]
[-canchpwd] [-pwdneverexpires] [-disabled] [-acctexpires]
[-reversiblepwd] [{-uc | -uco | -uci}] [-part PartitionDN [-qlimit]
[-qused]] [{-s Server | -d Domain}] [-u UserName] [-p {Password |
*}] [-c] [-q] [-l]
The syntax for viewing the group membership for users is
dsget user UserDN [-memberof [-expand]] [{-uc | -uco | -uci}] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-c] [-q] [-l]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSMOD COMPUTER
Modifies attributes of one or more computer accounts in the directory.
dsmod computer ComputerDN ... [-desc Description] [-loc Location]
[-disabled {yes | no}] [-reset] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-c] [-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSMOD GROUP
Modifies attributes of one or more group accounts in the directory.
dsmod group GroupDN ... [-samid SAMName] [-desc Description]
[-secgrp {yes | no}] [-scope {l | g | u}] [{-addmbr | -rmmbr |
-chmbr} MemberDN ...] [{-s Server | -d Domain}] [-u UserName]
[-p {Password | *}] [-c] [-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSMOD SERVER
Modifies properties of a domain controller.
dsmod server ServerDN ... [-desc Description] [-isgc {yes | no}]
[{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-c]
[-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSMOD USER
Modifies attributes of one or more user accounts in the directory.
dsmod user UserDN ... [-upn UPN] [-fn FirstName] [-mi Initial]
[-ln LastName] [-display DisplayName] [-empid EmployeeID]
[-pwd {Password | *}] [-desc Description] [-office Office] [-tel
PhoneNumber] [-email EmailAddress] [-hometel HomePhoneNumber]
[-pager PagerNumber] [-mobile CellPhoneNumber] [-fax FaxNumber]
[-iptel IPPhoneNumber] [-webpg WebPage] [-title Title] [-dept Department] [-company Company] [-mgr Manager] [-hmdir HomeDirectory]
[-hmdrv DriveLetter:] [-profile ProfilePath] [-loscr ScriptPath]
[-mustchpwd {yes | no}] [-canchpwd {yes | no}] [-reversiblepwd {yes
| no}] [-pwdneverexpires {yes | no}] [-acctexpires NumberOfDays]
[-disabled {yes | no}] [{-s Server | -d Domain}] [-u UserName]
[-p {Password | *}] [-c] [-q] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSMOVE
Moves or renames Active Directory objects.
dsmove objectdn [-newname newname] [-newparent parentdn]
[{-s server | -d domain}] [-u username] [-p {password | *}] [-q]
[{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY COMPUTER
Searches for computer accounts matching criteria.
dsquery computer [{startnode | forestroot | domainroot}] [-o {dn |
rdn | samid}] [-scope {subtree | onelevel | base}] [-name name]
[-desc description] [-samid samname] [-inactive numberofweeks]
[-stalepwd numberofdays] [-disabled] [{-s server | -d domain}]
[-u username] [-p {password | *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY CONTACT
Searches for contacts matching criteria.
dsquery contact [{startnode | forestroot | domainroot}] [-o {dn |
rdn}] [-scope {subtree | onelevel | base}] [-name name] [-desc description] [{-s server | -d domain}] [-u username] [-p {password
| *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY GROUP
Searches for group accounts matching criteria.
dsquery group [{startnode | forestroot | domainroot}] [-o {dn |
rdn | samid}] [-scope {subtree | onelevel | base}] [-name name]
[-desc description] [-samid SAMName] [{-s server | -d domain}]
[-u username] [-p {password | *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY PARTITION
Searches for Active Directory partitions matching criteria.
dsquery partition [-o {dn | rdn}] [-part filter] [{-s server |
-d domain}] [-u username] [-p {password | *}] [-q] [-r] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY QUOTA
Searches for disk quotas matching criteria.
dsquery quota {domainroot | objectdn} [-o {dn | rdn}] [-acct name]
[-qlimit filter] [-desc description] [{-s server | -d domain}]
[-u username] [-p {password | *}] [-q] [-r] [-limit numberofobjects]
[{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY SERVER
Searches for domain controllers matching criteria.
dsquery server [-o {dn | rdn}] [-forest] [-domain domainname] [-site sitename] [-name name] [-desc description] [-hasfsmo {schema | name
| infr | pdc | rid}] [-isgc] [{-s server | -d domain}] [-u username]
[-p {password | *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc
| -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY SITE
Searches for Active Directory sites matching criteria.
dsquery site [-o {dn | rdn}] [-name name] [-desc description] [{-s server | -d domain}] [-u username] [-p {password | *}] [-q] [-r]
[-gc] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY USER
Searches for user accounts matching criteria.
dsquery user [{startnode | forestroot | domainroot}] [-o {dn | rdn
| upn | samid}] [-scope {subtree | onelevel | base}] [-name name]
[-desc description] [-upn upn] [-samid samname] [-inactive numberofweeks] [-stalepwd numberofdays] [-disabled] [{-s server |
-d domain}] [-u username] [-p {password | *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc | -uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSQUERY *
Searches for any Active Directory objects matching criteria.
dsquery * [{startnode | forestroot | domainroot}] [-scope {subtree
| onelevel | base}] [-filter ldapfilter] [-attr {attributelist | *}]
[-attrsonly] [-l] [{-s server | -d domain}] [-u username] [-p
{password | *}] [-q] [-r] [-gc] [-limit numberofobjects] [{-uc |
-uco | -uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
DSRM
Deletes Active Directory objects.
dsrm objectdn ... [-subtree [-exclude]] [-noprompt] [{-s server |
-d domain}] [-u username] [-p {password | *}] [-c] [-q] [{-uc | -uco |
-uci}]
This command is available in Windows XP Professional if Windows Server 2003 Administration Tools Pack has been installed.
ECHO
Displays messages, or turns command echoing on or off.
echo [on | off]
echo [message]
ENDLOCAL
Ends localization of environment changes in a batch file.
Endlocal
ERASE
See DEL.
EVENTCREATE
Creates custom events in the event logs.
In Windows Server 2003, use
eventcreate [/s computer [/u domain\user [/p password]]
{[/l {application | system}] | [/so srcname]}
/t {success | error | warning | information} /id eventid /d
description
In Windows XP Professional, use
eventcreate [/s computer [/u domain\user [/p password]]
{[/l {application | system}] | [/so srcname]}
/t {error | warning | information} /id eventid /d description
EVENTQUERY
Searches event logs and collects event entries.
eventquery [/s Computer [/u [Domain\]User [/p Password]]] [/fi FilterName]
[/fo {table | list | csv}] [/r eventrange] [/nh] [/v]
[/l [application] [system] [security] ["dns server"]
[UserDefinedLog] [DirectoryLogName] [*]]
EVENTTRIGGERS /CREATE
Creates event triggers and sets the action to take.
eventtriggers /create [/s Computer [/u [Domain\]User [/p
[Password]]]] /tr Name [/l LogName] [/d Description] /tk Task {[/eid id] | [/t type] | [[/so source]} [/ru username [/rp password}}
EVENTTRIGGERS /DELETE
Removes an event trigger when it is no longer needed.
eventtriggers /delete /tid {ID [...] | *} [/s Computer [/u [Domain\] User [/p Password]]]
EVENTTRIGGERS /QUERY
Displays the event triggers currently configured on a specified system.
In Windows Server 2003, use
eventtriggers /query [/s Computer [/u [Domain\]User [/p Password]]]
[fo{table | list | csv}] [/nh] [/ v] [/id]
In Windows XP Professional, use
eventtriggers /query [/s Computer [/u [Domain\]User [/p Password]]]
[fo{table | list | csv}] [/nh] [/ v]
EXIT
Exits the command interpreter.
exit [/b] [exitcode]
EXPAND
Uncompresses files.
expand [-r] source destination
expand -r source [destination]
expand -d source.cab [-f:files]
expand source.cab -f:files destination
FC
Compares files and displays differences.
fc [/a] [/c] [/l] [/lbn] [/n] [/t] [/u] [/w]
[/nnnn][/offline][drive1:][path1]filename1
[drive2:][path2]filename2
fc /b [drive1:][path1]filename1
[drive2:][path2]filename2
FIND
Searches for a text string in files.
find [/v] [/c] [/n] [/i] [/offline] "string"
[[drive:][path]filename[ ...]]
FINDSTR
Searches for strings in files using regular expressions.
findstr [/b] [/e] [/l] [/r] [/s] [/i] [/x] [/v] [/n]
[/m] [/o] [/p] [/f:file] [/a:attr] [/c:string]
[/d:dir] [/g:file] [/offline] [strings]
[[drive:][path]filename[ ...]]
FOR
Runs a specified command for each file in a set of files.
Command-line FOR looping:
for %variable in (set) do command [parameters]
for /d %variable in (set) do command [parameters]
for /r [[drive:]path] %variable in (set) do command [parameters]
for /l %variable in (start,step,end) do command [parameters]
for /f ["options"] %variable in (set) do command [parameters]
Script FOR looping:
for %%variable in (set) do command [parameters]
for /d %%variable in (set) do command [parameters]
for /r [[drive:]path] %%variable in (set) do command [parameters]
for /l %%variable in (start,step,end) do command [parameters]
for /f ["options"] %%variable in (set) do command [parameters]
FORCEDOS
Starts a program in MS-DOS (command.com) rather than in Windows command shell (cmd.exe).
forcedos [/d directory] filename [parameters]
FORFILES
Selects one or more files and executes a command on each file.
forfiles [/p pathname] [/m searchmask] [/s] [/c command]
[/d [+ | -] {mm/dd/yyyy | dd}]
This command applies only to Windows Server 2003.
FORMAT
Formats a floppy disk or hard drive.
format drive: [/fs:file-system] [/v:label]
[/q] [/a:size] [/c] [/x]
format drive: [/v:label] [/q] [/f:size]
format drive: [/v:label] [/q] [/t:tracks
/n:sectors]
format drive: [/v:label] [/q]
FREEDISK
Checks a local or remote system to see if a necessary amount of free disk space is available on a particular drive.
freedisk [/s computer [/u [domain\]user [/p [pwd]]]] [/d drive]
[value]
This command applies only to Windows Server 2003.
FTP
Transfers files.
ftp [-v] [-d] [-i] [-n] [-g] [-s:filename]
[-a] [-w:windowsize] [host]
FTYPE
Displays or modifies file types used in file extension associations
ftype [fileType[=[command]]]
GETMAC
Displays network adapter information.
getmac [/s computer [/u [domain]\user [/p [pwd]]]]
[/fo {table|list|csv}] [/nh] [/v]
GETTYPE
Obtains basic configuration information from the operating system, including host name, operating system name, operating system version, role, and component information.
gettype [/s computer [/u [domain]\user [/p [pwd]]]] [/role | /sp |
/ver | /minv | /majv
| /type | /build]
This command applies only to Windows Server 2003.
GOTO
Directs the Windows command interpreter to a labeled line in a script.
goto :label
goto :EOF
GPUPDATE
Forces a background refresh of group policy.
gpupdate [/target:{computer | user}] [/force] [/wait:<value>]
[/logoff] [/boot] [/sync]
HOSTNAME
Prints the computer’s name.
hostname
IF
Performs conditional processing in batch programs.
if [not] errorlevel number command
if [not] [/i] string1==string2 command
if [not] exist filename command
if [/i] string1 compare-op string2 command
if cmdextversion number command
if defined variable command
INUSE
schedules replacement of operating system files on reboot.
inuse new_path/file current_path/file [/y]
This command applies only to Windows Server 2003.
IPCONFIG
Displays TCP/IP configuration.
ipconfig [/all] | [/release [adapter] | /renew [adapter]]
ipconfig /flushdns | /displaydns | /registerdns
ipconfig /showclassid adapter
ipconfig /setclassid adapter [classidtoset]]
LABEL
Creates, changes, or deletes the volume label of a disk.
label [drive:][label]
label [/mp] [volume] [label]
MD
Creates a directory or subdirectory.
mkdir [drive:]path
md [drive:]path
MEMMONITOR
Tracks detailed memory usage for individual processes.
memmonitor {/p ProcessID | /pn Name | /ps Service} [/wait] [/nodbg]
[/assumedbg] [/int Seconds] [/ws Value] [/ppool Value]
[/nppool Value] [/vm Value]
Windows Server 2003 Resource Kit.
MEMTRIAGE
Helps pinpoint the source of suspected memory leaks.
memtriage {/m | /p | /mp | /h ProcID} [/t Retry /w Length] LogFile.log
memtriage /s [/r RuleFile.ini /pid ProcID] LogFile.log
memtriage {/a [/pid ProcID] | /av} LogFile.log
Windows Server 2003 Resource Kit.
MKDIR
See MD.
MORE
Displays output one screen at a time.
more [/e [/c] [/p] [/s] [/tn] [+n]] <
[drive:][path]filename
more /e [/c] [/p] [/s] [/tn] [+n] [files] command-name | more [/e [/c] [/p] [/s]
[/tn] [+n]]
MOUNTVOL
Manages volume mount point.
mountvol [drive:]path volumeName
mountvol [drive:]path /d
mountvol [drive:]path /l
MOVE
Moves files from one directory to another directory on the same drive.
move [/y] [/-y] [source] [target]
NBTSTAT
Displays status of netbios.
nbtstat [-a remotename] [-A ipaddress] [-c]
[-n] [-r] [-R] [-RR] [-s] [-S]
[interval] ]
Note | This command uses case-sensitive switches. |
NET ACCOUNTS
Manage user account and password policies.
net accounts [/forcelogoff:{minutes | no}]
[/minpwlen:length]
[/maxpwage:{days | unlimited}]
[/minpwage:days]
[/uniquepw:number] [/domain]
NET COMPUTER
Adds or remove computers from a domain.
net computer \\computername {/add | /del}
NET CONFIG SERVER
Displays or modifies configuration of server service.
net config server [/autodisconnect:time]
[/srvcomment:"text"] [/hidden:{yes | no}]
NET CONFIG WORKSTATION
displays or modifies configuration of workstation service.
net config workstation [/charcount:bytes]
[/chartime:msec]
[/charwait:sec]
NET CONTINUE
Resumes a paused service.
net continue service
NET FILE
Displays or manages open files on a server.
net file [id [/close]]
NET GROUP
Displays or manages global groups.
net group [groupname [/comment:"text"]]
[/domain]
net group groupname {/add [/comment:"text"]
| /delete} [/domain]
net group groupname username [...]
{/add | /delete} [/domain]
NET LOCALGROUP
Displays local group accounts.
net localgroup [GroupName [/comment:"Text"]] [/domain]
Creates a local group account.
net localgroup GroupName {/add [/comment:"Text"]} [/domain]
Modifies local group accounts.
net localgroup [GroupName Name [ ...] /add [/domain]
Deletes a local group account.
net localgroup GroupName /delete [/domain]
NET NAME
Displays or modifies recipients for messenger service messages.
net name [name [/add | /delete]]
NET PAUSE
Suspends a service.
net pause service
NET PRINT
Displays or manages print jobs and shared queues.
net print \\computername\sharename
net print [\\computername] job#
[/hold | /release | /delete]
NET SEND
Sends a messenger service message.
net send {name | * | /domain[:name] | /users}
message
NET SESSION
Lists or disconnects sessions.
net session [\\computername] [/delete]
NET SHARE
Displays or manages shared printers and directories.
net share [sharename]
net share sharename[=drive:path]
[/users:number | /unlimited]
[/remark:"text"]
[/cache:flag]
net share {sharename | devicename |
drive:path} /delete
NET START
Lists or starts network services.
net start [service]
NET STATISTICS
Displays workstation and server statistics.
net statistics [workstation | server]
NET STOP
Stops services.
net stop service
NET TIME
Displays or synchronizes network time.
net time [\\computername |
/domain[:domainname] |
/rtsdomain[:domainname]] [/set]
net time [\\computername] /querysntp
net time [\\computername]
/setsntp[:serverlist]
NET USE
Displays or manages remote connections.
net use [devicename | *] [\\computername\sharename[\volume]
[password | *]] [/user:[domainname\]username] [/user:
[username@domainname] [[/delete] | [/persistent:{yes | no}]]
[/smartcard] [/savecred] net use [devicename | *] [password | *]]
[/home] net use [/persistent:{yes | no}]
NET USER
Creates local user accounts.
net user UserName [Password | *] /add [/active:{no | yes}]
[/comment:"DescriptionText"] [/countrycode:NNN] [/expires:
{{MM/DD/YYYY | DD/MM/YYYY | mmm,dd,YYYY} | never}]
[/fullname:"Name"] [/homedir:Path] [/passwordchg:{yes | no}]
[/passwordreq:{yes | no}] [/profilepath:[Path]] [/scriptpath:Path]
[/times:{Day[-Day][,Day[-Day]] ,Time[-Time][,Time[-Time]] [;...] |
all}] [/usercomment:"Text"] [/workstations:{ComputerName[,...] |
*}] [/domain]
Modifies local user accounts.
net user [UserName [Password | *] [/active:{no | yes}]
[/comment:"DescriptionText"] [/countrycode:NNN] [/expires:
{{MM/DD/YYYY | DD/MM/YYYY | mmm,dd,YYYY} | never}]
[/fullname:"Name"] [/homedir:Path] [/passwordchg:{yes | no}]
[/passwordreq:{yes | no}] [/profilepath:[Path]] [/scriptpath:Path]
[/times:{Day[-Day][,Day[-Day]] ,Time[-Time][,Time[-Time]] [;...] |
all}] [/usercomment:"Text"] [/workstations:{ComputerName[,...] |
*}]] [/domain]
Deletes local user accounts.
net user UserName [/delete] [/domain]
NET VIEW
Displays network resources or computers.
net view [\\computername [/cache] |
/domain[:domainname]]
net view /network:nw [\\computername]
NETSH
Invokes a separate command prompt that allows you to manage the configuration of various network services on local and remote computers.
netsh
More Info | Techniques for working with Netsh are discussed in Chapter 15, “Configuring, Maintaining, and Troubleshooting TCP/IP Networking.” |
NETSTAT
Displays status of network connections.
netstat [-a] [-e] [-n] [/o] [-s] [-p proto] [-r]
[interval]
NSLOOKUP
Shows the status of DNS.
nslookup [-option] [computer | server]
NTBACKUP
Backs up files.
ntbackup backup [systemstate] "@bksfilename"
/j {"jobname"}
[/p {"poolname"}]
[/t {"tapename"}]
[/n {"medianame"}]
[/f {"filename"}]
[/d {"setdescription"}]
[/ds {"servername"}]
[/is {"servername"}]
[/g {"guidname"}]
[/a] [/v:{yes|no}] [/r:{yes|no}]
[/l:{f|s|n}] [/m {backuptype}]
[/rs:{yes|no}] [/hc:{on|off}]
[/snap{on|off}]
PATH
Displays or sets a search path for executable files in the current command window.
path [[drive:]path[;...][;%PATH%]
path ;
PATHPING
Traces routes and provides packet loss information.
In Windows Server 2003, use
pathping [-n] [-h maxhops] [-g hostlist]
[-i address] [-p period]
[-q numqueries [-w timeout]
targetname [-4] [-6]
In Windows XP Professional, use
pathping [-n] [-h maxhops] [-g hostlist]
[-i address] [-p period] [-T] [-R] [-P]
[-q numqueries [-w timeout]
targetname [-4] [-6]
Note | This command uses case-sensitive switches. |
PAUSE
Suspends processing of a script and waits for keyboard input.
pause
PFMON
Displays detailed information on hard and soft page faults.
pfmon [/n | /l] [/c | /h] [/k | /K] [/p processid] [/d]
appcommandline
Windows Server 2003 Resource Kit.
Note | This command uses case-sensitive switches. |
PING
Determines if a network connection can be established.
ping [-t] [-a] [-n count] [-l size] [-f]
[-i ttl] [-v tos] [-r count] [-s count]
[[-j hostlist] | [-k hostlist]]
[-w timeout] destinationlist
PMON
Displays a detailed snapshot of resource usage and running processes.
pmon
Windows Server 2003 Resource Kit.
POPD
Changes to the directory stored by PUSHD.
popd
Prints a text file.
print [/d:device]
[[drive:][path]filename[...]]
PRINTDRIVERINFO
Displays driver information for all printer drivers configured on a local or remote system.
printdriverinfo [/s: ServerName] [/p: PrinterName] [/d: DriverName]
[/f: FileName]
Windows Server 2003 Resource Kit.
PROMPT
Changes the Windows command prompt.
prompt [text]
PUSHD
Saves the current directory then changes to a new directory.
pushd [path | ..]
RD
Removes a directory.
rmdir [/s] [/q] [drive:]path
rd [/s] [/q] [drive:]path
RECOVER
Recovers readable information from a bad or defective disk.
recover [drive:][path]filename
REG ADD
Adds a new subkey or entry to the registry.
reg add keyname [/v valuename | /ve] [/t datatype] [/d data] [/f]
[/s separator]
REG COMPARE
Compares registry subkeys or entries.
reg compare keyname1 keyname2 [/v valuename | /ve] [/s]
[/outputoption]
REG COPY
Copies a registry entry to a specified key path on a local or remote system.
reg copy keyname1 keyname2 [/s] [/f]
REG DELETE
Deletes a subkey or entries from the registry.
reg delete keyname [/v valuename | /ve | /va] [/f]
REG QUERY
Lists the entries under a key and the names of subkeys (if any).
In Windows Server 2003, use
reg query keyname [/v valuename | /ve] [/s] [/d data] [/k] [/d]
[/c] [/e] [/t type] [/z] [/se separator]
In Windows XP Professional, use
reg query keyname [/v valuename | /ve] [/s]
REG RESTORE
Writes saved subkeys and entries back to the registry.
reg restore keyname "filename"
REG SAVE
Saves a copy of specified subkeys, entries and values to a file.
reg save keyname "filename"
REGSVR32
Register and unregister DLLs.
regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname
REM
Adds comments to scripts.
rem [comment]
REN
Renames a file.
rename [drive:][path]filename1 filename2
ren [drive:][path]filename1 filename2
RMDIR
See RD.
ROUTE
Manages network routing tables.
route [-f] [-p] [command [destination]
[mask netmask] [gateway] [metric metric]] [if interface]
RUNAS
Run program with specific user permissions.
In Windows Server 2003, use
runas [/noprofile | /profile] [/env] [/netonly] [/savecred]
/user:account program
runas [/noprofile | /profile] [/env] [/netonly] [/savecred]
/smartcard [/user:account] program
In Windows XP Professional, use
runas [/noprofile | /profile] [/env] [/netonly] /user:account
program
runas [/noprofile | /profile] [/env] [/netonly] /smartcard
[/user:account] program
SC CONFIG
Configures service startup and logon accounts.
sc [\\ServerName] config ServiceName
[type= {own|share|{interact type = {own | share}}|kernel|
filesys|rec|adapt}]
[start= {boot|system|auto|demand|disabled}]
[error= {normal|severe|critical|ignore}]
[binPath= BinaryPathName]
[group= LoadOrderGroup]
[tag= {yes|no}]
[depend= Dependencies]
[obj= {AccountName|ObjectName}]
[DisplayName= displayname]
[password= password]
SC CONTINUE
Resumes a paused service.
sc [\\ServerName] continue ServiceName
SC FAILURE
Views the actions that will be taken if a service fails.
sc [\\ServerName] failure ServiceName [reset= ErrorFreePeriod]
[reboot= BroadcastMessage] [command= CommandLine]
[actions= FailureActionsAndDelayTime]
SC PAUSE
Pauses a service.
sc [\\ServerName] pause ServiceName
SC QC
Displays configuration information for a named service.
sc [\\ServerName] qc ServiceName [BufferSize]
SC QFAILURE
Sets the action to take upon failure of a service.
sc [\\ServerName] qfailure ServiceName [BufferSize]
SC QUERY
Displays the list of services configured on the computer.
sc [\\ServerName] query ServiceName
[type= {driver | service | all}]
[type= {own|share|interact|kernel|filesys|rec|adapt}]
[state= {active | inactive | all}] [bufsize= BufferSize]
[ri= ResumeIndex]
[group= GroupName]
SC START
Starts a service.
sc [\\ServerName] start ServiceName [ServicesArgs]
SC STOP
Stops a service.
sc [\\ServerName] stop ServiceName
SCHTASKS /CHANGE
Changes the properties of existing tasks.
In Windows Server 2003, use
schtasks /change /tn taskname [/s system [/u [domain\] user
[/p [password]]]] parameterstochange {[/ru user[ ]/rp password]
[/tr tasktorun]} [/st starttime] [/ri runintrrval] [{/et endtime |
/du duration} [/k]] [/sd startdate] [/ed enddate] [enable | disable]
[/it] [/z]
In Windows XP Professional, use
schtasks /change /tn taskname [/s system [/u [domain\] user
[/p [password]]]] parameterstochange {[/ru user[ ]/rp password]
[/tr tasktorun]}
SCHTASKS /CREATE
Creates scheduled tasks.
In Windows Server 2003, use
schtasks /create [/s system [/u [domain\] user [/p [password]]]]
[/ru [domain\] username [rp password]]/tn taskname /tr tasktorun
/sc scheduletype [/mo modifier] [/d day] [/i idletime] [/st starttime] [/m month [, month [...]]] [/sd startdate] [/ed enddate]
[/ri runintrrval] [{/et endtime | /du duration} [/k]] [/it] [/z] [/f]
In Windows XP Professional, use
schtasks /create [/s system [/u [domain\] user [/p [password]]]]
[/ru [domain\] username [rp password]]/tn taskname /tr tasktorun
/sc scheduletype [/mo modifier] [/d day] [/i idletime] [/st starttime] [/m month [, month [...]]] [/sd startdate] [/ed enddate]
SCHTASKS /DELETE
Removes scheduled tasks that are no longer wanted.
schtasks /delete /tn {TaskName | *} [/f] [/s Computer [/u
[Domain\]User [/p [Password]]]]
SCHTASKS /END
Stops a running task.
schtasks /end /tn taskname [/s computer [/u [domain\]user [/p
[password]]]]
SCHTASKS /QUERY
Displays scheduled tasks on the local or named computer.
schtasks /query [/s computer [/u [domain\]user [/p [password]]]]
[/fo {table | list | csv}] [/nh/ [/v]
SCHTASKS /RUN
Starts a scheduled task.
schtasks /run /tn taskname [/s computer [/u [domain\]user [/p
[password]]]]
SET
Displays or modifies Windows environment variables. Also used to evaluate numeric expressions at the command line.
set [variable=[string]]
set /a expression
set /p variable=[promptstring]
SETLOCAL
Begins localization of environment changes in a batch file.
setlocal
setlocal {enableext | disableext}
SFC
Scans and verifies protected system files.
sfc [/scannow] [/scanonce] [/scanboot] [/revert] [/purgecache]
[/cachesize=n]
SHIFT
Shifts the position of replaceable parameters in scripts.
shift [/n]
SHUTDOWN
Shuts down or restarts a computer.
In Windows Server 2003, use
shutdown [{-i |-l|-s|-r|-a}] [-f] [-m [\\computerName]] [-t nn]
[-c "message"] [-d [p]:n1:n2] [-h] [-e] [-p]
In Windows XP Professional, use
shutdown [{-i |-l|-s|-r|-a}] [-f]
[-m [\\computerName]] [-t nn]
[-c "message"] [-d[u][p]:n1:n2]
SORT
Sorts input.
[command |] sort [/r] [/+n] [/m kb] [/l locale] [/rec recordbytes]
[drive1:][path1]filename1] [/t [drive2:][path2]]
[/o [drive3:][path3]filename3]
Note | The symbol “|”, in this instance, is the pipe symbol. |
SPLINFO
Displays print spooling information.
splinfo [/z] [/v] [/d] [\\UNC_ComputerName]
Windows Server 2003 Resource Kit.
START
Starts a new command-shell window to run a specified program or command.
start ["title"] [/d path] [/i] [/min] [/max] [/separate|/shared]
[/wait] [/b] [/low | /belownormal | /normal | /abovenormal
| /high | /realtime] [command/program] [parameters]
SUBST
Maps a path to a drive letter.
subst [drive1: [drive2:]path]
subst drive1: /d
SYSTEMINFO
Displays detailed configuration information.
systeminfo [/s computer [/u [domain\]user [/p [pwd]]]] [/fo
{table|list|csv}] [/nh]
TAKEOWN
Allows an administrator to take ownership of one or more files.
takeown [/s computer [/u [domain\]user [/p [pwd]]]] /f filename
[/a] [/r [/d prompt]]
This command applies only to Windows Server 2003.
TASKKILL
Stops running processes by name or process ID.
taskkill [/s computer] [/u [domain\]user [/p pwd]]] {[/fi "filter"
[/fi filter2 [ ... ]]] [/pid ID|/im imgName]} [/f][/t]
TASKLIST
Lists all running processes by name and process ID.
tasklist [/s computer [/u [domain\]user [/p [password]]]]
[{/m module | /svc | /v}] [/fo {table | list | csv}] [/nh]
[/fi filtername [/fi filtername2 [ ... ]]]
TIME
Displays or sets the system time.
time [time | /T]
TIMEOUT
Sets a timeout period or waits for key press in batch script.
TIMEOUT /t timeout [/nobreak]
TITLE
Sets the title for the command-shell window.
title [string]
TRACERT
Displays the path between computers.
tracert [-d] [-h maximumhops] [-j hostlist] [-w timeout] targetname
TYPE
Displays the contents of a text file.
type [drive:][path]filename
VER
Displays the Windows version.
ver
VERIFY
Tells Windows whether to verify that your files are written correctly to a disk.
verify [on | off]
VOL
Displays a disk volume label and serial number.
vol [drive:]
WAITFOR
Specifies that a computer should wait for a particular signal before continuing.
Send signal syntax:
waitfor [/s computer [/u [domain\]user [/p [pwd]]]] /si signal
Wait signal syntax:
waitfor [/t timeout] signal
This command applies only to Windows Server 2003.
WHERE
Displays a list of files that match a search pattern.
where [/r dir] [/q] [/f] [/t] pattern
where [/q] [/f] [/t] $env:pattern
where [/q] [/f] [/t] path:pattern
This command applies only to Windows Server 2003.
WHOAMI
Displays log on and security information for the current user.
In Windows Server 2003, use
whoami [/upn | /fqdn | /logonid]
whoami /all [/fo {table|list|csv}] [nh]
In Windows XP Professional, use
whoami [/all][/user [/sid] [/logonid [/sid] [/groups [/sid]
[/priv [/sid] [/noverbose]]
In Windows XP Professional, the command is available through Support Tools.
| < Day Day Up > |
|