Windows 7 / Getting Started

Terminating a Session Using the Logoff Utility

The Logoff utility ends a user session and logs off the user. The advantage of this utility is that you can find it in older versions of Windows, so you can use the same script on just about any machine. The disadvantage of this utility is that it provides limited functionality. The ShutDown utility, described in the "Shutting Down the System with the ShutDown Command", is far more capable and you should use it whenever possible. This utility uses the following syntax:

LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]

The following list describes each of the command line arguments.

sessionname Defines the name of the session that you want to log off. Older versions of the tool don't provide this argument. The default is to log off the current session.

sessionid Defines the identifier of the session that you want to log off.

/SERVER:servername Specifies the server containing the user session to log off. Some documentation implies that you need Terminal Server to use this command line switch, but it appears to work just as well without it.

/V Displays detailed information about the actions the system performs during the logoff cycle.

Configuring System Devices with the Mode Utility

The Mode utility configures system devices for use. In addition, you can use it to display the status of a single device or all devices in the system. To display the status of all accessible devices type Mode and press Enter. If you want the status of just one device, type Mode followed by the device name, such as LPT1:, and press Enter. This utility uses the following syntax:

Serial Port
    MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s] [to={on |
	off}] [xon={on | off}] [odsr={on | off}] [octs={on | off}]
	[dtr={on | off | hs}] [rts={on | off | hs | tg}] [idsr={on |
	off}]
Device Status
    MODE [device] [/STATUS]
Redirect Printing
    MODE LPTn[:]=COMm[:]
Select Code Page
    MODE CON[:] CP SELECT=yyy
Code Page Status
    MODE CON[:] CP [/STATUS]
Display Mode
    MODE CON[:] [COLS=c] [LINES=n]
Typematic Rate
    MODE CON[:] [RATE=r DELAY=d]

The following list describes each of the command line arguments.

COMm[:] Defines the COM port to configure. The Mode utility recognizes any COM port for which it can find a device name. Generally, this means it will support COM1: through COM9: unless you have special hardware to make additional COM ports available.

NOTE: As you work with utilities at the command prompt, you'll find that different utilities support different numbers of ports. Most utilities support at least LPT1: through LPT3:, but you'll find a few that support up to LPT9:. Support for the COM (serial) ports is even more diverse. A few utilities only support COM1: through COM3:. More common is support for COM1: through COM4: for utilities. However, you'll find a few that support up to COM9: and a few that support as many COM ports as your machine has installed. One device is a constant: every workstation supports the CON: (console) device.

BAUD=b Determines the transmission rate of the COM port in bits per second (bps). Note that bps isn't always equivalent to baud; see the definition at http://webopedia.internet.com/ TERM/B/baud.html for details. Table-2 shows numbers you must use to specify a desired rate.

Table-2: Baud Rates Supported by the Mode Utility
Numeric Value 	Equivalent Baud Rate
11 		110 baud
15 		150 baud
30 		300 baud
60 		600 baud
12 		1,200 baud
24 		2,400 baud
48 		4,800 baud
96 		9,600 baud
19 		19,200 baud

PARITY=p Determines how the system checks for transmission errors. The mode command supports the values shown in Table-3.

Table-3: Parity Types Supported by the Mode Utility
Parity Value 	Parity Checking Type
n 		none
e 		even
o 		odd
m 		mark
s 		space

DATA=d Specifies the number of data bits per character. You may use any value between 5 and 8. The default setting of 7 provides support for standard ASCII characters. Use 8 for extended ASCII characters (the 256-character set). Not all computers support 5 or 6 bits per character.

STOP=s Specifies the number of stop bits after each character. You may specify 1, 1.5, and 2 as stop bit values. The default setting for 110 baud is 2. All other data transfer rates use 1 as a default value. Not all computers support 1.5 stop bits.

to={on | off} Specifies whether the computer uses infinite timeout processing. The default value is off. Setting this value to on means that the computer will wait literally forever to receive a response from a host or client computer.

xon={on | off} Specifies whether the system enables XON/XOFF protocol. The XON/ XOFF protocol provides flow control for serial communications, making them more reliable, but also exacting a performance penalty. You can learn more about the XON/XOFF protocol at http://docs.hp.com/en/32022-90051/ch09s08.html.

odsr={on | off} Specifies whether the system enables the Data Set Ready (DSR) output handshaking.

octs={on | off} Specifies whether the system enables the Clear to Send (CTS) output handshaking.

dtr={on | off | hs} Specifies whether the system enables the Data Terminal Ready (DTR) output handshaking. The on mode provides a constant signal showing the terminal is ready to receive data. The hs mode provides a handshaking signal between the two terminals.

rts={on | off | hs | tg} Specifies whether the system enables the Request to Send (RTS) output handshaking. The on mode provides a constant signal showing the terminal is ready to send data. The hs mode provides a handshaking signal between the two terminals. The tg mode provides a toggling feature between ready and not ready states.

idsr={on | off} Specifies whether the system enables DSR sensitivity. You must enable this feature to use DSR handshaking.

device Defines the name of the device that you want to work with. Standard names include LPT1: through LPT3:, COM1: through COM9:, and CON:.

/STATUS Specifies that you want to obtain the status of a specified device or of all accessible devices on the system.

LPTn[:] Defines the number of the LPT port to configure. Generally, this means supplying a name from LPT1: through LPT3: unless your system includes special parallel port support.

CON[:] Defines the console as the target for configuration or a status check.

NOTE: The Mode utility only supports physical devices. You can't use it to configure virtual devices. For example, if you redirect a network printer to use LPT1:, the Mode utility won't display any status information about it and you won't be able to configure the device in any way. However, if you have a physical LPT1 port on your machine, you can use the Mode utility to configure it. Because every workstation computer has a physical console, you can always use the Mode utility to configure the CON device and obtain status information about it.

CP Configures or queries the code page information for the selected device. Table 5.1 contains a list of the code pages that Windows supports natively. You can add support for additional code pages.

SELECT=yyy Determines the number of the code page to use with the selected device.

COLS=c Determines the number of columns displayed on screen. The default setting is 80 columns. Although you can configure the number of columns to any value, other standard values include 40 and 135. Using a nonstandard value can result in command line application problems.

LINES=n Determines the number of lines in the screen buffer. The default value is 25 (the other standard value is 50). You can use any value for the number of lines.

RATE=r Determines the typematic rate for the keyboard. The typematic rate determines how fast Windows will repeat a character when you press the associated key on the keyboard. You may use any value in the range from 1 through 32. The default setting is 20 characters per second. If you set the typematic rate, you must also set the delay.

DELAY=d Determines the delay between the time you press a key and the time Windows begins repeating the associated character on screen. Valid values for d are 1 (0.25 seconds), 2 (0.50 seconds), 3 (0.75 seconds), and 4 (1 second). The default value is 2.

[Previous] [Contents] [Next]