ASSOC Displays or modifies file extension associations
AT Schedules commands and programs to run on a computer.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
CACLS Displays or modifies access control lists (ACLs) of files.
CALL Calls one batch program from another.
CD Displays the name of or changes the current directory.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of or changes the current directory.
CHKDSK Checks a disk and displays a status report.
CLS Clears the screen.
CMD Starts a new instance of the Windows NT command interpreter.
COLOR Sets the default console foreground and background colors.
COMP Compares the contents of two files or sets of files.
COMPACT Displays or alters the compression of files on NTFS partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert the
current drive.
COPY Copies one or more files to another location.
DATE Displays or sets the date.
DEL Deletes one or more files.
DIR Displays a list of files and subdirectories in a directory.
DISKCOMP Compares the contents of two floppy disks.
DISKCOPY Copies the contents of one floppy disk to another.
DOSKEY Edits command lines, recalls Windows NT commands, and creates macros.
ECHO Displays messages, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE Deletes one or more files.
EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two files or sets of files, and displays the differences
between them.
FIND Searches for a text string in a file or files.
FINDSTR Searches for strings in files.
FOR Runs a specified command for each file in a set of files.
FORMAT Formats a disk for use with Windows NT.
FTYPE Displays or modifies file types used in file extension associations.
GOTO Directs the Windows NT command interpreter to a labeled line in a
batch program.
GRAFTABL Enables Windows NT to display an extended character set in graphics
mode.
HELP Provides Help information for Windows NT commands.
IF Performs conditional processing in batch programs.
KEYB Configures a keyboard for a specific language.
LABEL Creates, changes, or deletes the volume label of a disk.
MD Creates a directory.
MKDIR Creates a directory.
MODE Configures a system device.
MORE Displays output one screen at a time.
MOVE Moves one or more files from one directory to another directory on
the same drive.
NBTSTAT Displays protocol statistics and current TCP/IP connections using NBT
NET Networking information / configuration
NETSTAT Displays protocol statistics and current TCP/IP network connections.
PATH Displays or sets a search path for executable files.
PAUSE Suspends processing of a batch file and displays a message.
POPD Restores the previous value of the current directory saved by PUSHD.
PRINT Prints a text file.
PROMPT Changes the Windows NT command prompt.
PUSHD Saves the current directory then changes it.
RD Removes a directory.
RECOVER Recovers readable information from a bad or defective disk.
REM Records comments (remarks) in batch files or CONFIG.SYS.
REN Renames a file or files.
RENAME Renames a file or files.
REPLACE Replaces files.
RESTORE Restores files that were backed up by using the BACKUP command.
RMDIR Removes a directory.
SET Displays, sets, or removes Windows NT environment variables.
SETLOCAL Begins localization of environment changes in a batch file.
SHIFT Shifts the position of replaceable parameters in batch files.
SORT Sorts input.
START Starts a separate window to run a specified program or command.
SUBST Associates a path with a drive letter.
TIME Displays or sets the system time.
TITLE Sets the window title for a CMD.EXE session.
TREE Graphically displays the directory structure of a drive or path.
TYPE Displays the contents of a text file.
VER Displays the Windows NT version.
VERIFY Tells Windows NT whether to verify that your files are written
correctly to a disk.
VOL Displays a disk volume label and serial number.
XCOPY Copies files and directory trees.
******
* CMD
******
Starts a new instance of the Windows/NT command interpreter
(Extended in Win2k)
CMD [/X | /Y] [/A | /U] [/Q] [[/C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/Q Turns the echo off
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/X Enable extensions to the Windows NT version of CMD.EXE
/Y Disable extensions to the Windows NT version of CMD.EXE
Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes
Command Extensions are enabled by default. You may also disable
extensions for all invocations of the command processor by setting the
following value in the registry to 0
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
The command extensions involve changes and/or additions to the following
commands:
DEL or ERASE
COLOR
CD or CHDIR
MD or MKDIR
PROMPT
PUSHD
POPD
SET
SETLOCAL
ENDLOCAL
IF
FOR
CALL
SHIFT
GOTO
START (also includes changes to external command invocation)
ASSOC
FTYPE
To get specific details, type HELP commandname to view the specifics.
******
* DEL
******
Deletes one or more files.
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] [[drive:][path]filename
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] [[drive:][path]filename
[drive:][path]filename
Specifies the file(s) to delete. Specify multiple
files by using wildcards.
/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for archiving
- Prefix meaning not
If Command Extensions are enabled DEL and ERASE change as follows:
The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.
******
* COLOR
******
Sets the default console foreground and background colors.
COLOR [attr]
attr Specifies color attribute of console output
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.
Example: "COLOR fc" produces light red on bright white
******
* CD
******
Displays the name of or changes the current directory.
CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]
.. Specifies that you want to change to the parent directory.
Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.
Use the /D switch to change current drive in addition to changing current
directory for a drive.
If Command Extensions are enabled CHDIR changes as follows:
The current directory string is converted to use the same case as
the on disk names. So CD C:\TEMP would actually set the current
directory to C:\Temp if that is the case on disk.
CHDIR command does not treat spaces as delimeters, so it is possible to
CD into a subdirectory name that contains a space without surrounding
the name with quotes. For example:
cd \winnt\profiles\username\programs\start menu
is the same as:
cd "\winnt\profiles\username\programs\start menu"
which is what you would have to type if extensions were disabled.
******
* FOR
******
Runs a specified command for each file in a set of files.
(Extended in Win2k)
FOR %variable IN (set) DO command [command-parameters]
%variable Specifies a replaceable parameter.
(set) Specifies a set of one or more files. Wildcards may be used.
command Specifies the command to carry out for each file.
command-parameters
Specifies parameters or switches for the specified command.
To use the FOR command in a batch program, specify %%variable instead
of %variable Variable names are case sensitive, so %i is different
from %I.
If Command Extensions are enabled, the following additional
forms of the FOR command are supported:
FOR /D %variable IN (set) DO command [command-parameters]
If set contains wildcards, then specifies to match against directory
names instead of file names.
FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]
Walks the directory tree rooted at [drive:]path, executing the FOR
statement in each directory of the tree. If no directory
specification is specified after /R then the current directory is
assumed. If set is just a single period (.) character then it
will just enumerate the directory tree.
FOR /L %variable IN (start,step,end) DO command [command-parameters]
The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)
FOR /F ["options"] %variable IN (filenameset) DO command [command-parameters]
filenameset is one or more file names. Each file is opened, read
and processed before going on to the next file in filenameset.
Processing consists of reading in the file, breaking it up into
individual lines of text and then parsing each line into zero or
more tokens. The body of the for loop is then called with the
variable value(s) set to the found token string(s). By default, /F
passes the first blank separated token from each line of each file.
Blank lines are skipped. You can override the default parsing
behavior by specifying the optional "options" parameter. This
is a quoted string which contains one or more keywords to specify
different parsing parameters. The keywords are:
eol=c - specifies an end of line comment character
(just one)
skip=n - specifies the number of lines to skip at the
beginning of the file.
delims=xxx - specifies a delimeter set. This replaces the
default delimiter set of space and tab.
tokens=x,y,m-n - specifies which tokens from each line are to
be passed to the for body for each iteration.
This will cause additional variable names to
be allocated. The m-n form is a range,
specifying the mth through the nth tokens. If
the last character in the tokens= string is an
asterisk, then an additional variable is
allocated and receives the remaining text on
the line after the last token parsed.
Some examples might help:
FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k
would parse each line in myfile.txt, ignoring lines that begin with
a semicolon, passing the 2nd and 3rd token from each line to the for
body, with tokens delimited by commas and/or spaces. Notice the for
body statements reference %i to get the 2nd token, %j to get the
3rd token, and %k to get all remaining tokens after the 3rd.
%i is explicitly declared in the for statement and the %j and %k
are implicitly declared via the tokens= option. You can specify up
to 26 tokens via the tokens= line, provided it does not cause an
attempt to declare a variable higher than the letter 'z'. Remember,
FOR variable names are global, and you can't have more than 26 total
active at any one time.
You can also use the FOR /F parsing logic on an immediate string, by
making the filenameset between the parenthesis a quoted string. It
will be treated as a single line of input from a file and parsed.
Finally, you can use the FOR /F command to parse the output of a
command. You do this by making the filenameset between the
parenthesis a single quoted string. It will be treated as a command
line, which is passed to a child CMD.EXE and the output is captured
into memory and parsed as if it was a file. So the following
example:
FOR /F "delims==" %i IN ('set') DO @echo %i
would enumerate the environment variable names in the current
environment.
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:
%~fi - expands %i to a fully qualified path name
%~di - expands %i to a drive letter only
%~pi - expands %i to a path only
%~ni - expands %i to a file name only
%~xi - expands %i to a file extension only
%~si - expanded path contains short names only
%~$PATH:i - searches the directories listed in the PATH
environment variable and expands %i 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:
%~dpi - expands %i to a drive letter and path only
%~nxi - expands %i to a file name and extension only
%~fsi - expands %i to a full path name with short names only
%~dp$PATH:i - searches the directories listed in the PATH
environment variable for %i and expands to the
drive letter and path of the first one found.
In the above examples %i and PATH can be replaced by other
valid values. Just be careful to pick your FOR variable letters
to not conflict with any of the format specifier letters if you
plan on using the enhanced substitution logic.
******
* IF
******
Performs conditional processing in batch programs.
(Extended in Win2k)
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
NOT Specifies that Windows NT should carry out the command only
if the condition is false.
ERRORLEVEL number Specifies a true condition if the last program run returned
an exit code equal to or greater than the number specified.
command Specifies the command to carry out if the condition is
met.
string1==string2 Specifies a true condition if the specified text strings
match.
EXIST filename Specifies a true condition if the specified filename
exists.
If Command Extensions are enabled IF changes as follows:
IF [/I] string1 compare-op string2 command
IF CMDEXTVERSION number command
IF DEFINED variable command
where compare-op may be one of:
EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal
and the /I switch, if specified, says to do case insensitive string
compares. 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.
The CMDEXTVERSION conditional works just like ERRORLEVEL, except it is
comparing against an internal version number associated with the Command
Extensions. The first version is 1. It will be incremented by one when
significant enhancements are added to the Command Extensions.
CMDEXTVERSION conditional is never true when Command Extensions are
disabled.
The DEFINED conditional works just like EXISTS except it takes an
environment variable name and returns true if the environment variable
is defined.
%ERRORLEVEL% will expand 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. Using this and the above numerical
comparision operators, you can do the following
choice
goto answer%ERRORLEVEL%
:answer0
echo You typed Y for yes
:answer1
echo You typed N for no
you can also using the numerical comparisons above:
IF %ERRORLEVEL% LEQ 1 goto okay
%CMDCMDLINE% will expand 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.
******
* MD
******
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
If Command Extensions are enabled MKDIR changes as follows:
MKDIR creates any intermediate directories in the path, if needed.
For example, assume \a does not exist then:
mkdir \a\b\c\d
is the same as:
mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d
which is what you would have to type if extensions were disabled.
******
* PROMPT
******
Changes the cmd.exe command prompt.
PROMPT [text]
text Specifies a new command prompt.
Prompt can be made up of normal characters and the following special codes:
$A & (Ampersand)
$B | (pipe)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$G > (greater-than sign)
$H Backspace (erases previous character)
$L < (less-than sign)
$N Current drive
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows NT version number
$_ Carriage return and linefeed
$$ $ (dollar sign)
If Command Extensions are enabled the PROMPT command supports
the following additional formatting characters:
$+ zero or more plus sign (+) characters depending upon the
depth of the PUSHD directory stack, one character for each
level pushed.
$M Displays the remote name associated with the current drive
letter or the empty string if current drive is not a network
drive.
******
* PUSHD
******
Stores the current directory for use by the POPD command, then
changes to the specified directory.
PUSHD [path | ..]
path Specifies the directory to make the current directory.
If Command Extensions are enabled the PUSHD command accepts
network paths in addition to the normal drive letter and path.
If a network path is specified, PUSHD will create a temporary
drive letter that points to that specified network resource and
then change the current drive and directory, using the newly
defined drive letter. Temporary drive letters are allocated from
Z: on down, using the first unused drive letter found.
******
* POPD
******
Changes to the directory stored by the PUSHD command.
POPD
If Command Extensions are enabled the POPD command will delete
any temporary drive letter created by PUSHD when you POPD that
drive off the pushed directory stack.
******
* RD
******
Removes (deletes) a directory.
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
******
* SET
******
Displays, sets, or removes cmd.exe environment variables.
(Extended in Win2k)
SET [variable=[string]]
variable Specifies the environment-variable name.
string Specifies a series of characters to assign to the variable.
Type SET without parameters to display the current environment variables.
If Command Extensions are enabled SET changes as follows:
SET command invoked with just a variable name, no equal sign or value
will display the value of all variables whose prefix matches the name
given to the SET command. For example:
SET P
would display all variables that begin with the letter 'P'
SET command will set the ERRORLEVEL to 1 if the variable name is not
found in the current environment.
SET command will allow an equal sign (=) in the value of an environment
variable in any position other than the first character.
A new switch is added to the SET command:
SET /A expression
The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated. The expression evaluator
is pretty simple and supports the following operations, in decreasing
order of precedence:
() - grouping
* / % - arithmetic operators
+ - - arithmetic operators
<< >> - logical shift
& - bitwise and
^ - bitwise exclusive or
| - bitwise or
= *= /= %= += -= - assignment
&= ^= |= <<= >>=
, - expression separator
If you use any of the logical or modulus operators, you will need to
enclose the expression string in quotes. Any non-numeric strings in the
expression are treated as environment variable names whose values are
converted to numbers before using them. If an environment variable name
is specified but is not defined in the current environment, then a value
of zero is used. This allows you to do arithmetic with environment
variable values without having to type all those % signs to get their
values. If SET /A is executed from the command line outside of a
command script, then it displays the final value of the expression. The
assignment operator requires an environment variable name to the left of
the assignment operator. Numeric values are decimal numbers, unless
prefixed by 0x for hexidecimal numbers, 0b for binary numbers and 0 for
octals numbers. So 0x12 is the same as 0b10010 is the same as 022.
Please note that the octal notation can be confusing: 08 and 09 are
not valid numbers because 8 and 9 are not valid octal digits.
Environment variable substitution has been enhanced as follows:
%PATH:str1=str2%
would expand the PATH environment variable, substituting each occurrence
of "str1" in the expanded result with "str2". "str2" can be the empty
string to effectively delete all occurrences of "str1" from the expanded
output. "str1" can begin with an asterisk, in which case it will match
everything from the begining of the expanded output to the first
occurrence of the remaining portion of str1.
%PATH:~10,5%
would expand the PATH environment variable, and then use only the 5
characters that begin at the 11th (offset 10) character of the expanded
result.
******
* SETLOCAL
******
Begins localization of environment changes in a batch file.
Environment changes made after SETLOCAL has been issued are
local to the batch file. ENDLOCAL must be issued to
restore the previous settings.
SETLOCAL
If Command Extensions are enabled SETLOCAL changes as follows:
SETLOCAL batch command now accepts an optional argument, which can be
either ENABLEEXTENSIONS or DISABLEEXTENSIONS. This will enable or
disable the Command process extensions until the matching ENDLOCAL
command, regardless of their setting prior to the SETLOCAL command.
The SETLOCAL command will set the ERRORLEVEL value if given
an argument. It will be zero if one of the two valid arguments
is given and one otherwise. You can use this in batch scripts
to determine if the extensions are available, using the following
technique:
VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 echo Unable to enable extensions
This works because on old versions of CMD.EXE, SETLOCAL does NOT
set the ERRORLEVEL value. The VERIFY command with a bad argument
initializes the ERRORLEVEL value to a non-zero value.
******
* ENDLOCAL
******
Ends localization of environment changes in a batch file.
Environment changes made after ENDLOCAL has been issued are
not local to the batch file; the previous settings are not
restored on termination of the batch file.
ENDLOCAL
If Command Extensions are enabled ENDLOCAL changes as follows:
If the corresponding SETLOCAL enable or disabled command extensions
using the new ENABLEEXTENSIONS or DISABLEEXTENSIONS options, then
after the ENDLOCAL, the enabled/disabled state of command extensions
will be restored to what it was prior to the matching SETLOCAL
command execution.
******
* CALL
******
Calls one batch program from another.
(Extended in Win2k)
CALL [drive:][path]filename [batch-parameters]
batch-parameters Specifies any command-line information required by the
batch program.
If Command Extensions are enabled CALL changes as follows:
CALL command now accepts labels as the target of the CALL. The syntax
is:
CALL :label arguments
A new batch file context is created with the specified arguments and
control is passed to the statement after the label specified. You must
"exit" twice by reaching the end of the batch script file twice. The
first time you read the end, control will return to just after the CALL
statement. The second time will exit the batch script. Type GOTO /?
for a description of the GOTO :EOF extension that will allow you to
"return" from a batch script.
In addition, expansion of batch script argument references (%0, %1,
etc.) have been changed as follows:
%* in a batch script refers to all the arguments (e.g. %1 %2 %3
%4 %5 ...)
Substitution of batch parameters (%n) has been enhanced. You can
now use the following optional syntax:
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - changes the meaning of n and x options to
reference the short name instead
%~$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:
%~dp1 - expands %1 to a drive letter and path only
%~nx1 - expands %1 to a file name and extension only
%~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.
In the above examples %1 and PATH can be replaced by other
valid values
******
* SHIFT
******
Changes the position of replaceable parameters in a batch file.
SHIFT [/n]
If Command Extensions are enabled the SHIFT command supports
the /n switch which tells the command to start shifting at the
nth argument, where n may be between zero and eight. For example:
SHIFT /2
would shift %3 to %2, %4 to %3, etc. and leave %0 and %1 unaffected.
******
* GOTO
******
Directs cmd.exe to a labeled line in a batch program.
GOTO label
label Specifies a text string used in the batch program as a label.
You type a label on a line by itself, beginning with a colon.
If Command Extensions are enabled GOTO changes as follows:
GOTO command now accepts a target label of :EOF which transfers control
to the end of the current batch script file. This is an easy way to
exit a batch script file without defining a label. Type CALL /? for a
description of extensions to the CALL command that make this feature
useful.
******
* 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] [command/program] [parameters]
"title" Title to display in window title bar.
path Starting directory
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
WAIT Start application and wait for it to terminate
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt the
application
command/program
If it is an internal cmd command or a batch file then
the command processor is run with the /K switch to cmd.exe.
This means that the window will remain after the command
has been run.
If it is not an internal cmd command or batch file then
it is a program and will run as either a windowed application
or a console application.
parameters These are the parameters passed to the command/program
If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:
non-executable files may be invoked through their file association just
by typing the name of the file as a command. (e.g. WORD.DOC would
launch the application associated with the .DOC file extension).
See the ASSOC and FTYPE commands for how to create these
associations from within a command script.
When executing an application that is a 32-bit GUI application, CMD.EXE
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 CMD without an
extension or path qualifier, then replaces CMD with the value of the
COMSPEC variable, thus avoiding picking up random versions of
CMD.EXE when you least expect them.
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
Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.
When executing a command, if there is no match on any extension, then
looks to see if the name, without any extension, matches a directory name
and if it does, the START command launches the Explorer on that path.
If done from the command line, it is the equivalent to doing a CD /D
to that path.
******
* ASSOC
******
Displays or modifies file extension associations
ASSOC [.ext[=[fileType]]]
.ext Specifies the file extension to associate the file type with
fileType Specifies the file type to associate with the file extension
Type ASSOC without parameters to display the current file associations.
If ASSOC is invoked with just a file extension, it displays the current
file association for that file extension. Specify nothing for the file
type and the command will delete the association for the file extension.
******
* FTYPE
******
Displays or modifies file types used in file extension associations
FTYPE [fileType[=[openCommandString]]]
fileType Specifies the file type examine or change
openCommandString Specifies the open command to use when launching files
of this type.
Type FTYPE without parameters to display the current file types that
have open command strings defined. FTYPE is invoked with just a file
type, it displays the current open command string for that file type.
Specify nothing for the open command string and the FTYPE command will
delete the open command string for the file type. Within an open
command string %0 or %1 are substituted with the file name being
launched through the assocation. %* gets all the parameters and %2
gets the 1st parameter, %4 the second, etc. %~n gets all the remaining
parameters starting with the nth parameter, where n may be between 2 and 9,
inclusive. For example:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
would allow you to invoke a Perl script as follows:
script.pl 1 2 3
If you want to eliminate the need to type the extensions, then do the
following:
set PATHEXT=.pl;%PATHEXT%
and the script could be invoked as follows:
script 1 2 3
******
* MORE
******
Displays output one screen at a time.
MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < [drive:][path]filename
command-name | MORE [/E [/C] [/P] [/S] [/Tn] [+n]]
MORE /E [/C] [/P] [/S] [/Tn] [+n] [files]
[drive:][path]filename Specifies a file to display one
screen at a time.
command-name Specifies a command whose output
will be displayed.
/E Enable extended features
/C Clear screen before displaying page
/P Expand FormFeed characters
/S Squeeze multiple blank lines into a single line
/Tn Expand tabs to n spaces (default 8)
Switches can be present in the MORE environment
variable.
+n Start displaying the first file at line n
files List of files to be displayed. Files in the list
are separated by blanks.
If extended features are enabled, the following commands
are accepted at the -- More -- prompt:
P n Display next n lines
S n Skip next n lines
F Display next file
Q Quit
= Show line number
? Show help line
<space> Display next page
<ret> Display next line
******
* FINDSTR
******
Searches for strings in files.
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/F:file]
[/C:string] [/G:file] [strings] [[drive:][path]filename[ ...]]
/B Matches pattern if at the beginning of a line.
/E Matches pattern if at the end of a line.
/L Uses search strings literally.
/R Uses search strings as regular expressions.
/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 filename if a file contains a match.
/O Prints character offset before each matching line.
/P Skip files with non-printable characters
/F:file Reads file list from the specified file(/ stands for console).
/C:string Uses specified string as a literal search string.
/G:file Gets search strings from the specified file(/ stands for console).
strings Text to be searched for.
[drive:][path]filename
Specifies a file or files to search.
Use spaces to separate multiple search strings unless the argument is prefixed
with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.
Findstr--Notes
Findstr is capable of finding the exact text you are looking for in any
ASCII file or files. Sometimes, however, you have only part of the information
that you want to match, or you want to find a wider range of information. In
such cases, findstr has the powerful capability to search for patterns of
text using regular expressions.
Regular expressions are a notation for specifying patterns of text, as opposed
to exact strings of characters. The notation uses literal characters and
metacharacters. Every character that does not have special meaning in the
regular-expression syntax is a literal character and matches an occurance of
that character. For example, letters and numbers are literal characters. A
metacharacter is a symbol with special meaning (an operator or delimiter) in
the regular-expression syntax. These are the metacharacters accepted by findstr:
. Wildcard: any character
* Repeat: zero or more occurances of previous character or class
^ Line position: beginning of line
$ Line position: end of line
[class] Character class: any one character in set
[^class] Inverse class: any one character not in set
[x-y] Range: any characters within the specified range
\x Escape: literal use of metacharacter x
\<xyz Word position: beginning of word
xyz\> Word position: end of word
The special characters in regular expression syntax are most powerful when
they are used together. For example, the following combination of the wildcard
character (.) and repeat (*) characters
.*
matches any string of characters. This expression is useful when it is part of a
larger expression, such as
b.*ing
which matches any string beginning with B and ending with ing.
More Information About Findstr
Findstr--Examples
To find all occurances of the word Windows (with an initial capital w) in the
file PROPOSAL.TXT, type
findstr Windows proposal.txt
To search every file in the current directory and all subdirectories that
contained the word Windows, regardless of the letter case, type
findstr /s /i Windows *.*
To find all occurances of lines that contain the word FOR, preceeded by any number
of spaces, (as in a computer program loop) and to include the line number where
each occurance is found, type
findstr /b /n /c:" *FOR" *.bas
If you want to search for several different items in the same set of files, create
a text file that contains each search criteria on a new line. You can also list
the exact files you want to search in a text file. To use the search criteria in
the file FINDDATA.TXT and search the files listed in FILELIST.TXT then store the
results in the file RESULTS.OUT, type
findstr /g:finddata.txt /f:filelist.txt > results.out
Assume you wanted to find every file in the current directory and all
subdirectories that contained the word computer, regardless of the letter
case. To list every file containing the word computer, type
findstr /s /i /m "\<computer\>" *.*
Now assume you want to find not only the word computer, but also any other words
that begin with the letters comp, such as compliment and compete. Type
findstr /s /i /m "\<comp.*" *.*
******
* TITLE
******
Sets the window title for the command prompt window.
TITLE [string]
string Specifies the title for the command prompt window.
******
* AT
******
The AT command 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"
\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an 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 Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/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 each specified day(s) of the week or
month. 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). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.
******
* NET
******
Networking commands
NET HELP
The syntax of this command is:
NET HELP command
-or-
NET command /HELP
Commands available are:
NET ACCOUNTS NET HELP NET SHARE
NET COMPUTER NET HELPMSG NET START
NET CONFIG NET LOCALGROUP NET STATISTICS
NET CONFIG SERVER NET NAME NET STOP
NET CONFIG WORKSTATION NET PAUSE NET TIME
NET CONTINUE NET PRINT NET USE
NET FILE NET SEND NET USER
NET GROUP NET SESSION NET VIEW
NET HELP SERVICES lists the network services you can start.
NET HELP SYNTAX explains how to read NET HELP syntax lines.
NET HELP command | MORE displays Help one screen at a time.
NET ACCOUNTS
The syntax of this command is:
NET ACCOUNTS [/FORCELOGOFF:{minutes | NO}] [/MINPWLEN:length]
[/MAXPWAGE:{days | UNLIMITED}] [/MINPWAGE:days]
[/UNIQUEPW:number] [/DOMAIN]
NET ACCOUNTS [/SYNC]
NET ACCOUNTS updates the user accounts database and modifies password
and logon requirements for all accounts.
When used without options, NET ACCOUNTS displays the current settings for
password, logon limitations, and domain information.
Two conditions are required in order for options used with
NET ACCOUNTS to take effect:
_ The password and logon requirements are only effective if user
accounts have been set up (use User Manager or the NET USER command).
_ The Net Logon service must be running on all servers in the domain
that verify logon. Net Logon is started automatically when Windows NT
starts.
/SYNC Updates the user accounts database.
/FORCELOGOFF:{minutes | NO} Sets the number of minutes a user has
before being forced to log off when the
account expires or valid logon hours expire.
NO, the default, prevents forced logoff.
/MINPWLEN:length Sets the minimum number of characters for
a password. The range is 0-14 characters;
the default is 6 characters.
/MAXPWAGE:{days | UNLIMITED} Sets the maximum number of days that a
password is valid. No limit is specified
by using UNLIMITED. /MAXPWAGE can't be less
than /MINPWAGE. The range is 1-49710; the
default is 90 days.
/MINPWAGE:days Sets the minimum number of days that must
pass before a user can change a password.
A value of 0 sets no minimum time. The range
is 0-49710; the default is 0 days. /MINPWAGE
can't be more than /MAXPWAGE.
/UNIQUEPW:number Requires that a user's passwords be unique
through the specified number of password
changes. The maximum value is 24.
/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 NT
Workstation computers that are members of
a Windows NT Server domain. By default,
Windows NT Server computers perform
operations on the primary domain controller.
NET SHARE
The syntax of this command is:
NET SHARE sharename
sharename=drive:path [/USERS:number | /UNLIMITED]
[/REMARK:"text"]
sharename [/USERS:number | /UNLIMITED]
[/REMARK:"text"]
{sharename | devicename | drive:path} /DELETE
NET SHARE makes a server's resources available to network users. When
used without options, it lists information about all resources being
shared on the computer. For each resource, Windows NT reports the
devicename(s) or pathname(s) and a descriptive comment associated with it.
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 can
simultaneously access the shared resource
/REMARK:"text" Adds a descriptive comment about the resource.
Enclose the text in quotation marks.
devicename Is one or more printers (LPT1: through LPT9:)
shared by sharename.
/DELETE Stops sharing the resource.
NET COMPUTER
The syntax of this command is:
NET COMPUTER \\computername {/ADD | /DEL}
NET COMPUTER adds or deletes computers from a domain database. This
command is available only on Windows NT Servers.
\\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 HELPMSG
The syntax of this command is:
NET HELPMSG message#
NET HELPMSG displays information about Windows NT network messages
(such as error, warning, and alert messages). When you type NET HELPMSG and
the 4-digit number of the Windows NT error (for example, NET2182),
Windows NT tells you about the message and suggests action you can take
to solve a problem.
message# Is the 4-digit number of the Windows NT message you need help
with. You don't need to type NET as part of the message number.
NET START
The syntax of this command is:
NET START [service]
NET START lists running services.
To get more help about a specific service,
see the online Command Reference (NTCMDS.HLP).
service Is one of the following services:
ALERTER
CLIENT SERVICE FOR NETWARE
CLIPBOOK SERVER
COMPUTER BROWSER
DHCP CLIENT
DIRECTORY REPLICATOR
EVENTLOG
FTP SERVER
LPDSVC
MESSENGER
NET LOGON
NETWORK DDE
NETWORK DDE DSDM
NETWORK MONITORING AGENT
NT LM SECURITY SUPPORT PROVIDER
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
SNMP
SPOOLER
TCPIP NETBIOS HELPER
UPS
WORKSTATION
These services are available only on Windows NT Server:
FILE SERVER FOR MACINTOSH
GATEWAY SERVICE FOR NETWARE
MICROSOFT DHCP SERVER
PRINT SERVER FOR MACINTOSH
REMOTEBOOT
WINDOWS INTERNET NAME SERVICE
When typed at the command prompt, service names of two words or more must
be enclosed in quotation marks. For example, NET START "COMPUTER BROWSER"
starts the computer browser service.
NET START can also start network services not provided with Windows NT.
NET CONFIG
The syntax of this command is:
NET CONFIG [SERVER | WORKSTATION]
NET CONFIG displays configuration information of the Workstation or
Server service. When used without the SERVER or WORKSTATION switch,
it displays a list of configurable services. To get help with
configuring a service, type NET HELP CONFIG service.
SERVER Displays information about the configuration of
the Server service.
WORKSTATION Displays information about the configuration of
the Workstation service.
NET LOCALGROUP
The syntax of this command is:
NET LOCALGROUP [groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]
NET LOCALGROUP modifies local groups on computers. When used without
options, it displays the local groups on the computer.
groupname Is 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.
Enclose the text in quotation marks.
/DOMAIN Performs the operation on the domain controller
of the current domain. Otherwise, the operation is
performed on the local workstation.
This parameter applies only to Windows NT
Workstation computers that are members of
a Windows NT Server domain. By default,
Windows NT Server computers perform
operations on the primary domain controller.
name [ ...] Lists one or more usernames or groupnames to add or to
remove from a local group. Separate multiple entries with
a space. Names may be users or global groups, but not
other local groups. If a user is from another domain,
preface the username with the domain name (for
example, SALES\RALPHR).
/ADD Adds a groupname or username to a local group. An account
must be established for users or global groups added to a
local group with this command.
/DELETE Removes a groupname or username from a local group.
NET STATISTICS
The syntax of this command is:
NET STATISTICS [WORKSTATION | SERVER]
NET STATISTICS displays the statistics log for the local Workstation or
Server service. Used without parameters, NET STATISTICS displays
the services for which statistics are available.
SERVER Displays the Server service statistics.
WORKSTATION Displays the Workstation service statistics.
NET CONFIG SERVER
The syntax of this command is:
NET CONFIG SERVER [/AUTODISCONNECT:time]
[/SRVCOMMENT:"text"]
[/HIDDEN:{YES | NO}]
NET CONFIG SERVER displays or changes settings for the Server service.
/AUTODISCONNECT:time 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
is -1-65535 minutes; the default is 15.
/SRVCOMMENT:"text" Adds a comment for the server that is displayed in
Windows NT 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 server's computername
appears on display listings of servers. Note that
hiding a server does not alter the permissions
on that server. The default is NO.
To display the current configuration for the Server service,
type NET CONFIG SERVER without parameters.
NET NAME
The syntax of this command is:
NET NAME [name [/ADD | /DELETE]]
NET NAME adds or deletes a messaging name (alias) at a computer.
A messaging name is a name to which messages are sent. When used without
options, NET NAME displays the names accepting messages at the computer.
A computer's list of names comes from three places:
_ Message names, which are added with NET NAME
_ A computername, which is added as a name when the Workstation
service is started. This name cannot be deleted.
_ A username, which is added as a name when you log on, if it
is not being used at another computer. This name can be deleted.
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.
NET STOP
The syntax of this command is:
NET STOP service
NET STOP stops Windows NT services.
Stopping a service cancels any network connections the service is
using. Also, some services are dependent on others. Stopping one
service can stop others.
You must have administrative rights to stop the Server service.
The Eventlog service cannot be stopped.
service Is one of the following services:
ALERTER
CLIENT SERVICE FOR NETWARE
CLIPBOOK SERVER
COMPUTER BROWSER
DIRECTORY REPLICATOR
FTP SERVER
LPDSVC
MESSENGER
NET LOGON
NETWORK DDE
NETWORK DDE DSDM
NETWORK MONITORING AGENT
NT LM SECURITY SUPPORT PROVIDER
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
SNMP
SPOOLER
TCPIP NETBIOS HELPER
UPS
WORKSTATION
These services are available only on Windows NT Server:
FILE SERVER FOR MACINTOSH
GATEWAY SERVICE FOR NETWARE
MICROSOFT DHCP SERVER
PRINT SERVER FOR MACINTOSH
REMOTEBOOT
WINDOWS INTERNET NAME SERVICE
NET STOP can also stop network services not provided with Windows NT.
NET CONFIG WORKSTATION
The syntax of this command is:
NET CONFIG WORKSTATION [/CHARCOUNT:bytes]
[/CHARTIME:msec]
[/CHARWAIT:sec]
NET CONFIG WORKSTATION displays or changes settings for
the Workstation service.
/CHARCOUNT:bytes Specifies the amount of data Windows NT collects
before sending the data to a communication device.
If /CHARTIME:msec is also set, Windows NT acts on
whichever option is satisfied first.
The range is 0-65535 bytes; the default is 16 bytes.
/CHARTIME:msec Sets the number of milliseconds Windows NT collects
data before sending the data to a communication device.
If /CHARCOUNT:bytes is also set, Windows NT acts on
whichever option is satisfied first. The range
is 0-65535000 milliseconds; the default is
250 milliseconds.
/CHARWAIT:sec Sets the number of seconds Windows NT waits for a
communication device to become available. The range
is 0-65535 seconds; the default is 3600 seconds.
To display the current configuration for the Workstation service,
type NET CONFIG WORKSTATION without parameters.
NET PAUSE
The syntax of this command is:
NET PAUSE service
NET PAUSE suspends a Windows NT service or resource. Pausing a service
puts it on hold.
service Is the service to be paused.
Can be one of the following:
FILE SERVER FOR MACINTOSH
FTP SERVER
LPDSVC
NET LOGON
NETWORK DDE
NETWORK DDE DSDM
NT LM SECURITY SUPPORT PROVIDER
REMOTEBOOT
REMOTE ACCESS SERVER
SCHEDULE
SERVER
SIMPLE TCP/IP SERVICES
WORKSTATION
NET TIME
The syntax of this command is:
NET TIME [\\computername | /DOMAIN[:domainname]] [/SET]
NET TIME synchronizes the computer's clock with that of another computer
or domain, or displays the time for a computer or domain. When used without
options on a Windows NT Server domain, it displays the current
date and time at the computer designated as the time server for the domain.
\\computername Is the name of the computer you want to check or
synchronize with.
/DOMAIN[:domainname] Specifies the domain with which to synchronize time.
/SET Synchronizes the computer's time with the time
on the specified computer or domain.
NET CONTINUE
The syntax of this command is:
NET CONTINUE service
NET CONTINUE reactivates a Windows NT service that has been
suspended by NET PAUSE.
service Is the paused service.
Can be one of the following:
FILE SERVER FOR MACINTOSH
FTP SERVER
LPDSVC
NET LOGON
NETWORK DDE
NETWORK DDE DSDM
NT LM SECURITY SUPPORT PROVIDER
REMOTEBOOT
REMOTE ACCESS SERVER
SCHEDULE
SERVER
SIMPLE TCP/IP SERVICES
WORKSTATION
NET PRINT
The syntax of this command is:
NET PRINT \\computername\sharename
[\\computername] job# [/HOLD | /RELEASE | /DELETE]
NET PRINT displays print jobs and shared queues.
For each queue, the display lists jobs, showing the size
and status of each job, and the status of the queue.
\\computername Is the name of the computer sharing the printer
queue(s).
sharename Is the name of the shared printer queue.
job# Is the identification number assigned to a print
job. A computer with one or more printer queues
assigns each print job a unique number.
/HOLD Prevents a job in a queue from printing.
The job stays in the printer queue, and other
jobs bypass it until it is released.
/RELEASE Reactivates a job that is held.
/DELETE Removes a job from a queue.
NET USE
The syntax of this command is:
NET USE [devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
NET USE [devicename | *] [password | *]] [/HOME]
NET USE [/PERSISTENT:{YES | NO}]
NET USE connects a computer to a shared resource or disconnects a
computer from a shared resource. When used without options, it lists
the computer's connections.
devicename Assigns a name to connect to the resource or specifies
the device to be disconnected. There are two kinds of
devicenames: disk drives (D: through Z:) and printers
(LPT1: through LPT3:). Type an asterisk instead of a
specific devicename to assign the next available
devicename.
\\computername Is the name of the computer controlling the shared
resource. If the computername contains blank characters,
enclose the double backslash (\\) and the computername
in quotation marks (" "). The computername may be from
1 to 15 characters long.
\sharename Is the network name of the shared resource.
\volume Specifies a NetWare volume on the server. You must have
Client Services for Netware (Windows NT Workstations)
or Gateway Service for Netware (Windows NT Server)
installed and running to connect to NetWare servers.
password Is 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 username with which the connection
is made.
domainname Specifies another domain. If domain is omitted,
the current logged on domain is used.
username Specifies the username with which to logon.
/HOME Connects a user to their home directory.
/DELETE Cancels a network connection and removes the connection
from the list of persistent connections.
/PERSISTENT Controls the use of persistent network connections.
The default is the setting used last.
YES Saves connections as they are made, and restores
them at next logon.
NO Does not save the connection being made or subsequent
connections; existing connections will be restored at
next logon. Use the /DELETE switch to remove
persistent connections.
NET FILE
The syntax of this command is:
NET FILE [id [/CLOSE]]
NET FILE closes a shared file and removes file locks. When used without
options, it lists the open files on a server. The listing includes the
identification number assigned to an open file, the pathname of the file,
the username, and the number of locks on the file.
This command works only on computers running the Server service.
id Is the identification number of the file.
/CLOSE Closes an open file and removes file locks. Type this command
from the server where the file is shared.
NET SEND
The syntax of this command is:
NET SEND {name | * | /DOMAIN[:name] | /USERS} message
Sends messages to other users, computers, or messaging names
on the network. The Messenger service must be running to receive messages.
You can send a message only to an name that is active on the network.
If the message is sent to a username, that user must be logged on
and running the Messenger service to receive the message.
name Is the username, computername, or messaging name
to send the message to. If the name is a
computername that contains blank characters,
enclose the alias in quotation marks (" ").
* Sends the message to all the names in your group.
/DOMAIN[:name] Sends the message to all the names in the
workstation 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 Is text to be sent as a message.
NET USER
The syntax of this command is:
NET USER [username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]
NET USER creates and modifies user accounts on computers. When used
without switches, it lists the user accounts for the computer. The
user account information is stored in the user accounts database.
This command works only on servers.
username Is 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 14 characters.
* 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 current domain.
This parameter applies only to Windows NT
Workstation computers that are members of
a Windows NT Server domain. By default,
Windows NT Server computers perform
operations on the primary domain controller.
/ADD Adds a user account to the user accounts database.
/DELETE Removes a user account from the user accounts database.
Options Are as follows:
Options Description
--------------------------------------------------------------------
/ACTIVE:{YES | NO} Activates or deactivates the account. If
the account is not active, the user cannot
access the server. The default is YES.
/COMMENT:"text" Provides a descriptive comment about the
user's account (maximum of 48 characters).
Enclose the text in quotation marks.
/COUNTRYCODE:nnn Uses the operating system country code to
implement the specified language files for a
user's help and error messages. A value of
0 signifies the default country code.
/EXPIRES:{date | NEVER} Causes the account to expire if date is
set. NEVER sets no time limit on the
account. An expiration date is in the
form mm/dd/yy or dd/mm/yy, depending on the
country code. Months can be a number,
spelled out, or abbreviated with three
letters. Year can be two or four numbers.
Use slashes(/) (no spaces) to separate
parts of the date.
/FULLNAME:"name" Is a user's full name (rather than a
username). Enclose the name in quotation
marks.
/HOMEDIR:pathname 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.
/SCRIPTPATH:pathname Is the location of the user's logon
script.
/TIMES:{times | ALL} Is the logon hours. TIMES is expressed as
day[-day][,day[-day]],time[-time][,time
[-time]], limited to 1-hour increments.
Days can be spelled out or abbreviated.
Hours can be 12- or 24-hour notation. For
12-hour notation, use am, pm, a.m., or
p.m. ALL means a user can always log on,
and a blank value means a user can never
log on. Separate day and time entries with
a comma, and separate multiple day and time
entries with a semicolon.
/USERCOMMENT:"text" Lets an administrator add or change the User
Comment for the account.
/WORKSTATIONS:{computername[,...] | *}
Lists as many as eight computers from
which a user can log on to the network. If
/WORKSTATIONS has no list or if the list is *,
the user can log on from any computer.
NET GROUP
The syntax of this command is:
NET GROUP [groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname username [...] {/ADD | /DELETE} [/DOMAIN]
NET GROUP adds, displays, or modifies global groups on servers. Used
without parameters, it displays the groupnames on the server.
groupname Is the name of the group to add, expand, or delete.
Supply only a groupname 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 NT
Workstation computers that are members of
a Windows NT Server domain. By default,
Windows NT Server computers perform
operations on the primary domain controller.
username[ ...] Lists one or more usernames to add to or remove from
a group. Separate multiple username entries with a space.
/ADD Adds a group, or adds a username to a group.
/DELETE Removes a group, or removes a username from a group.
NET SESSION
The syntax of this command is:
NET SESSION [\\computername] [/DELETE]
NET SESSION lists or disconnects sessions between the computer and other
computers on the network. When used without options, it displays information
about all sessions with the computer of current focus.
This command works only on servers.
\\computername Lists the session information for the named computer.
/DELETE Ends the session between the local computer and
computername, and closes all open files on the computer
for the session. If computername is omitted,
all sessions are ended.
NET VIEW
The syntax of this command is:
NET VIEW [\\computername | /DOMAIN[:domainname]]
NET VIEW /NETWORK:NW [\\computername]
NET VIEW displays a list of resources being shared on a computer. When used
without options, it displays a list of computers in the current domain or
network.
\\computername Is a 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 local area
network.
/NETWORK:NW Displays all available servers on a NetWare
network. If a computername is specified, the
resources available on that computer in
the NetWare network will be displayed.
NETSTAT
Displays protocol statistics and current TCP/IP network connections.
NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]
-a Displays all connections and listening ports. (Server-side
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.
-p proto Shows connections for the protocol specified by proto; proto
may be tcp or udp. If used with the -s option to display
per-protocol statistics, proto may be tcp, udp, or ip.
-r Displays the contents of the routing table.
-s Displays per-protocol statistics. By default, statistics are
shown for TCP, UDP and IP; the -p option may be used to specify
a subset of the default.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press CTRL+C to stop redisplaying
statistics. If omitted, netstat will print the current
configuration information once.
NBTSTAT
Displays protocol statistics and current TCP/IP connections using NBT
(NetBIOS over TCP/IP).
NBTSTAT [-a RemoteName] [-A IP address] [-c] [-n]
[-r] [-R] [-RR] [-s] [-S] [interval] ]
-a (adapter status) Lists the remote machine's name table given its name
-A (Adapter status) Lists the remote machine's name table given its
IP address.
-c (cache) Lists the global remote name cache including the IP addr
esses
-C (cache) Lists the remote name cache with IP addresses on a per-d
evice basis
-n (names) Lists local NetBIOS names.
-r (resolved) Lists names resolved by broadcast and via WINS
-R (Reload) Purges and reloads the remote cache name table
-S (Sessions) Lists sessions table with the destination IP addresses
-s (sessions) Lists sessions table converting destination IP
addresses to host names via the hosts file.
-RR (ReleaseRefresh) Sends Name Release packets to WINs and then, starts Refr
esh
RemoteName Remote host machine name.
IP address Dotted decimal representation of the IP address.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press Ctrl+C to stop redisplaying
statistics.
script page