Basic Commands


-H-


-I-


IF
The IF command provides conditional comand execution.

Syntax:
1. IF [NOT] ERRORLEVEL level command
2. IF [NOT] [/I] str1==str2 command
3. IF [NOT] EXIST file command
4. IF [/I] val1 op val2 command
5. IF CMDEXTVERSION version command
6. IF [NOT] DEFINED varname command
7. IF test (command) ELSE (command)

Switches:
/I Specifies string comparisons are to be case insensitive.

See also:
SET, Variable Syntax, Standard Variables


IFMEMBER (Windows NT Resource Kit)
The IFMEMBER command checks Windows NT group membership for the current logged-on user. Specify a list of one or more group names for checking, seperated by spaces. For each group, IFMEMBER checks to see if the current logged-on user is a member of that group. IFMEMBER then returns a count of the numbers of matches as its exit code.

Syntax:
IFMEMBER groupname [...]

Example:
ifmember Administrators
if not errorlevel 1 exit

See also:
GLOBAL, LOCAL, NET GROUP


INSTSRV (Windows NT Resource Kit)
The INSTSRV command installs a Windows NT service executable file. Services are special .EXE files designed specifically to execute as Windows NT services. They are managed by the service control manager (SCM), and execute independently of interactive logons.

Syntax:
1. INSTSRV servicename drive:path\filename [-A acct] [-P pwd]
2. INSTSRV servicename REMOVE

Switches:
-A acct Execute thee service using the specified account name.
-P pwd Logon to the specified account name using the specified password.

Use INSTSRV(1) to install a new service. The service is assigned the specified servicename, which then appears in the list of services, such as that presented by the Control Panel. The executable for the service must also be specified. Alway sinclude the full drive and path name to the executable file.

Use INSTSRV(2) to remove a previously installed service. The .EXE file is not deleted by this operation.

See also:
SC, SCLIST


IPCONFIG
The command line utility IPCONFIG is used to examine TCP/IP configuration.
Use:
IPCONFIG to display a summary of TCP/IP configuration information.
IPCONFIG /ALL to display full details of the configuration of TCP/IP, including MAC addresses.
IPCONFIG /RELEASE to release an IP address previously obtained from a DHCP server and return it to the scope.
IPCONFIG /RENEW to get an IP address from the DHCP server.


-J-


-K-


KILL (Windows NT Resource Kit)
The KILL command kills a Windows NT process.

Syntax:
1. KILL [-F] pid
2. KILL [-F] name

Switches:
-F Force the process kill.

Use KILL(1) to kill a process by process ID (pid). Use Task Manager or
PULIST


-L-


Labels
Marks a target for control flow transfers.

Syntax:
:label

A LABEL is a line in a script file comprised of a colon followed by a label name. Valid label names follow the same syntax conventions as filenames, except that spaces are not allowed. Labels must appear at the start of a line, and cannot be part of a compund or multi-line command. Spaces are permitted before and after the colon character.

The label :EOF is special. If this label is not defined in the script file, it is assumed to exist at the very end of the file. In this way, the statement GOTO :EOF means jump to the end of the script and can be interpreted as an "exit" or "return" statement.

See also:
CALL, GOTO


LOCAL (Windows NT Resource Kit)
The LOCAL command displays the member list for a specified local group.

Syntax:
LOCAL groupname domain|\\computername

The local group is specified using groupname. LOCAL locates the group either in the specified domain or on the specified computer.


See also:
GLOBAL, IFMEMBER, NET GROUP


LOGEVENT (Windows NT Resource Kit)
The LOGEVENT command adds events to the Windows NT application event log.

Syntax:
1. LOGEVENT
2. LOGEVENT [-M \\computer] [-S severity] [-C category] text

Use LOGEVENT(1) to install the event log program. This step is necessary on any computer that is to view the event log information generated by LOGEVENT. LOGEVENT(2) also performs the installation step if it detects that LOGEVENT has not been executed previously.

Use LOGEVENT(2) to add an event to the event log. The event should be described using text. The -M switch specifies which computer recieves the event log entry. The default is the local computer. The -S switch sets the severity of the event being logged. Severity values are shown in the following table:

S Success audit.
F Failure audit.
I Information event.
W Warning event.
E Error event.

The -C switch includes an optional event category. The category is a numerical value stored as part of the event. Its meaning is specific to the event being logged.

Example:
logevent -s -i -c 400 "File write error: log.txt"

See also:
DUMPEL


LOGOFF (WIndows NT Resource Kit)
Log of the current Windows NT session.

Syntax:
LOGOFF [/F] [/N]

Switches:
/F Force applications to close without saving un-saved data.
/N Do not confirm before logoff.
The LOGOFF command terminates the current Windows NT session. Normally, LOGOFF confirms that a logoff is desired and then prompt the user to save unsaved data before proceeding. The /F switch forces applications to close without saving data. The /N switch skips the logoff confirmation request.



LPD
LPD is the line printer daemon. With this installed on NT the server will accept LPR and LPQ requests from hosts. This means NT can accept print jobs and queue request information from Unix hosts and share printers installed on NT with them.


LPQ
The LPQ command is used to query the print queue on a machine running LPD.

lpq -S ip_address -P printer_name -L


LPR
LPR is used to submit jobs to the LPD service for printing.

lpr -S ip_address -P printer_name filename


-M-


MKDIR, MD
The MKDIR command creates a new directory or directories. The MD command is a synonym for MKDIR.

Syntax:
1. MKDIR [drive:]path
2. MD [drive:]path

The MKDIR command can create a complete tree of directories in a single command, by creating all intermediate directories specified in path. For example, the command MKDIR C:\A\B\C\D creates directory C:\A, then C:\A\B, then C:\A\B\C etc as necessary.

See also:
RMDIR, CHDIR


MORE
The MORE command splits up files into pages. This allows command output to br viewed that would otherwise scroll off the console window.

Syntax:
1. MORE
2. MORE /E [/C] [/P] [/S] [/Tn] [+n]
3. MORE /E [/C] [/P] [/S] [/Tn] [+n] file [...]

Switches:
/E Enable extended features
/C Clear screen before displaying page of output.
/P Expand form-feed characters.
/S Collapse multiple blank lines into one.
/Tn Expand tabs to column n.
+n Start ouput at line n.

Use MORE(1) or MORE(2) to filter command input. By default, the command input is all text typed at the console up to the end of file character, Ctrl+Z. Use the console input redirection symbols to redirect console input from a file or device. Use the pipe command to send the output of any command to the command input of the MORE command for processing.

Use MORE(3) to filter one or more text files. File names are seperated by spaces.

At the end of each page of output, MORE displays the prompt -MORE - and waits for user input. Press any key to continue to the next page. If the /E switch is used, the following commands can be entered at the prompt:
Pn Display the next n lines.
Sn Skip the next n lines.
F Display the next file. Only applicable to MORE(3).
Q Quit.
= Show line number.
? Show help.
Spacebar Display next page.
Enter Display next line.

See also:
FIND, SORT


MOVE
The MOVE command moves files and directories from one location to another.

Syntax:
1. MOVE [drive:][path]filename [drive:]dstpath
2. MOVE [drive:][path]srcpath [drive:]dstpath

Use MOVE(1) to move individual files to the specified dstpath directory. Wildcards can be used with filename to move multiple files.

Use MOVE(2) to move a complete directory to the specified dstpath directory. The entire directory, including all files and subdirectories, is moved.


See also:
XCOPY, ROBOCOPY, RENAME