Net Use Complete Command Reference How to Tutorial

NET Command Syntax Chart The following chart can be used as a quick reference to the options available from the NET command. The NET Command Syntax Chart itself is available on-line using the NET KEY command.

The NET Command

The NET Command Program

NET Command Syntax Chart

Symbols Purpose { } Braces indicate a parameter you must use [ ] Brackets indicate an optional parameter | Bar indicates a choice of parameters * Used in place of password, prompts for password /D Indicates that you wish to cancel a NET SHARE or NET USE /L Locks a NET USE command, the NET USE cannot be cancelled /RWC Specifies network access rights /R /W /RW /WC /RWC d: Indicates a drive letter from A: to Z: (LASTDRIVE= parameter must be set in your CONFIG.SYS file if you wish to use drives F: thru Z:) path Indicates a drive and directory (e.g. C:ACCOUNTS) password 1-8 Character password (case insensitive) computername 1-15 Characters identifying a CLIENT or SERVER computer name device A DOS device name:- PRN, LPT1,2,3,4, COM1,2,3,4, AUX1,2,3,4 number 1-25 digit telephone number (may include Hayes dial syntax) servername 1-15 characters identifying a SERVER computer name sharename 1-16 character name that represents a DOS path or DOS device name syspass 1-16 character password (System Administration Password) username 1-8 character username (for use with the NET LOGON command) You must include all punctuation (except braces, brackets and bars) such as periods, equal signs, forward slashes and backslashes, where illustrated in the syntax.

NET USE / CONNECT This command allows you to associate a local drive letter or device name with a shared network drive or device. The device may be a printer LPT1 thru LPT4, a serial port COM1 thru COM4, AUX1 thru AUX4 or a logical driveA: thru Z:. The NET USE command is issued to USE or CONNECT to a shared network drive, or device, on the network. The commands NET USE and NET CONNECT are interchangeable. Originally IBM used NET USE and Microsoft used NET CONNECT. OTEX LAN allows both. In all the following examples the NET USE is used as it is now the preferred method. The NET USE command is only available on a client configuration, that is, you must have previously loaded either NETWORK.COM or CLIENT.COM. Before you can use any network device or drive, it must have been previously shared using the NET SHARE command from the server machine. If you are familiar with the NET USE command and just need to refresh your memory, simply read the Command Syntax In Brief. If you are not familiar with the NET USE command it is recommended that you also read the Command Syntax In Depth. All NET USE commands are provided in pop-up menu form using the OTEX LAN Station Manager. The Station Manager (SM.COM) may be accessed thru the DOS-NET Main Menu using the network keys CTRL+ALT+Right Shift simultaneously. For more details on pop-up menus see Chapter 4 “THE DOS-NET MAIN MENU”. Command Syntax In Brief Connecting to a network drive

Connecting to a network drive There are two methods of connecting to a network drive. The first is to specify the drive letter on the server to which you wish to connect, the second is to connect to the network drive using a network name. The drive to which you wish to connect, must have been previously shared using the NET SHARE command from the server machine.

Syntax: NET USE {d:} {servername}[d:] [password | *] To connect to a server’s shared C: drive, using our F: drive, where the server’s name is SERVER1, use the following command: NET USE F: SERVER1C: Once connected to the server’s C: drive using your F: drive, you may run any software on the server from your client machine. To access the server you must use the F: drive. It is preferable to use a network name when connecting to a network drive, rather than specifying the target drive directly. Connecting to a network drive using a network sharename

Syntax: NET USE {d:} {servername}sharename] [password | *] To connect to the server’s driver known as MYDRIVE using your F: drive, where the server’s name is SERVER1, use the following command: NET USE F: SERVER1MYDRIVE The advantages of using a network sharename over specifying the drive to which you wish to connect is that the server can change the drive it is sharing (e.g.the as D:) without the client having to change its NET USE command to match. The client simply connects to whatever drive is associated with MYDRIVE. This gives the server greater control over shared drives. Connecting to a network directory Sometimes it is useful to connect to a specific directory, rather than an entire network drive. The following commands explain how to connect to a directory. The directory must have been previously shared using the NET SHARE command from the server.

Syntax: NET USE {d:} {computername}[path] [password | *] To connect to a server’s shared C:ACCOUNTS directory using our F: drive, where the server’s name is SERVER1, use the following command: NET USE F: SERVER1C:ACCOUNTS Once connected to the shared directory, that directory appears as your F:> root directory. This means that you will be limited to that directory level only. The path to your accounts software run from the F: drive will be F: not F:ACCOUNTS. It is preferable to use a network sharename when connecting to the server’s directory, rather than specifying the target directory name. Connecting to a network directory using a network sharename

Syntax: NET USE {d:} {servername}[sharename] [password | *] To connect to a server’s directory known as PAYROLL using our F: drive, where the server’s name is SERVER1, use the following command: NET USE F: SERVER1PAYROLL Once connected to PAYROLL using our F: drive, the accounts software may be loaded and run as normal from your client machine. When you connect to a server’s directory, that directory appears as your F:> root directory. You will be limited to that directory only. The path to your software will be F:not F:ACCOUNTS. The advantage of using a network sharename over connecting to the directory directly is that the server can change the drive and directory name (e.g. D:PAY95) at a later date, without having to change the client machine’s NET USE command to match. The clients simply connect to whatever drive and directory is associated with the network sharename PAYROLL. This gives the server greater control of shared directories. Access rights The access rights associated with each drive or directory are controlled by the server’s NET SHARE command. Each user connected to a server’s drive or directory (using a password if specified) inherits the access rights that have been assigned to that particular drive or directory. If a client or client application attempts to violate their designated access rights, they will receive an error message to the effect of “Access Denied”. Passwords A password may be specified on the NET SHARE command line. If a password is specified, then all network users must specify the same password on their NET USE command line, before they are granted access to the shared serial port. Using passwords The following command connects your F: drive to the directory known as PAYROLL on the server SERVER1, using the password SECRET. NET USE F: SERVER1PAYROLL SECRET If the password is incorrect an error message will be displayed stating an “Invalid Password” was specified. Disconnecting from a drive or directory When you have finished using the network drive, you can cancel the NET USE command using the /delete parameter. This is abbreviated to /d.

Syntax: NET USE {d:} /d The following command deletes a previous NET USE command that connected your F: drive to the server’s PAYROLL directory. NET USE F: /d The F: drive is now a local drive again. If you try to access F: drive, the error message “Invalid drive specified” will be displayed, unless you actually have a physical F: drive on the client machine. Connecting to a network printer There are two methods of connecting to a network printer. The first is to specify the device name on the server to which you wish to connect. The second is to connect to the network printer using a network sharename. The printer to which you wish to connect must have been previously shared using the NET SHARE command from the server machine.

NOTE The printer redirector (PRNREDIR.COM) must be loaded on the client machine, and the printer spooler (SPOOLER.COM) must be loaded on the print server machine, before you can print from a client machine to a server’s printer. This is done via the NETSETUP.EXE configuration program.

Syntax: NET USE {device} {servername}[device] [password | *] To connect to a server’s printer on LPT1 using your LPT1, where the server’s name is SERVER1, use the following command: NET USE LPT1: SERVER1LPT1 Once connected, you may print as normal using LPT1 as your print device name. It is preferable to use a network name when connecting to a network printer rather than specify the target print device name. Connecting to a network printer using a network sharename

Syntax: NET USE {device} {servername}sharename] [password | *] To connect to the server’s printer known as LASER using your LPT1, where the server’s name is SERVER1, use the following command: NET USE LPT1 SERVER1LASER Once connected, you may print as normal using LPT1 as your print device name. The advantages of using a network sharename over specifying the printer device by which you wish to connect, is that the server can change the printer device it is sharing (e.g. to LPT2) without the client having to change its NET USE command to match. The clients simply connect to whatever printer is associated with LASER. This gives the server greater control over shared printers. Access rights Access rights have no effect when using network printers. Passwords A password may be specified on the NET SHARE command line. If a password is specified, then all network users must specify the same password on their NET USE command line, before they are granted access to the shared printer. Using passwords The following command connects your LPT1 to the server’s printer known as LASER on the server SERVER1, using the password SECRET. NET USE LPT1 SERVER1LASER SECRET If the password is incorrect an error message will be displayed stating an “Invalid Password” was specified. Disconnecting from a network printer When you have finished using the network printer you can cancel the NET USE command using the /delete parameter. This is abbreviated to /d.

Syntax: NET USE {device} /d To delete a previous NET USE command connecting your LPT1 to the server’s printer known as LASER, type the following command: NET USE LPT1 /d The LPT1 printer is now a local printer again. If you now print to LPT1, you will be printing to your local printer attached to your local LPT1. Connecting to a network serial port There are two methods of connecting to a network serial port. The first is to specify the device name on the server to which you wish to connect. The second is to connect to the network serial port using a network sharename. The serial port to which you wish to connect must have been previously shared using the NET SHARE command from the server machine.

NOTE The communications redirector (COMREDIR.COM) must be loaded on both the server and the client machines before you can use network serial ports.

Syntax: NET USE {device} {servername}[device] [password | *] To connect to a server’s shared serial port COM1 (AUX1) using your COM1, where the server’s name is SERVER1, use the following command: NET USE AUX1: SERVER1AUX1 It is preferable to use a network sharename when connecting to the server’s serial port rather than specifying the target serial port device name. Connecting to a network serial port using a network sharename

Syntax: NET USE {device} {servername}sharename] [password | *] To connect to the server’s serial port known as COMPORT using your COM1 (AUX1), where the server’s name is SERVER1, use the following command: NET USE AUX1 SERVER1COMPORT The advantage of using a network name over specifying the serial port device to which you wish to connect, is that the server can change the serial port device (e.g. to COM2), without the client having to change its NET USE command to match. The client simply connects to whatever serial port is associated with COMPORT. This gives the server greater control over shared serial ports. Access rights Access rights have no effect when using network serial ports. Passwords A password may be specified on the NET SHARE command line.If a password is specified, then all network users must specify the same password on their NET USE command line, before they are granted access to the shared serial port. Using passwords To connect your COM1 (AUX1) to the server’s serial port known as COMPORT on the server SERVER1, using the password SECRET, use the following command: NET USE AUX1 SERVER1COMPORT SECRET If the password is incorrect an error message will be displayed stating an “Invalid Password” was specified. Disconnecting from a network serial port When you have finished using the network printer, you can cancel the NET USE command using the /delete parameter. This is abbreviated to /d.

Syntax: NET USE {device} /d To delete a previous NET USE command that connected the COM1 (AUX1) to the server’s serial port known as COMPORT, use the following command: NET USE AUX1 /d The COM1 serial port is now local again. If you now communicate using COM1, you will be communicating using your local serial port. Displaying the connection list You can verify the connection status of any redirected resources using the NET USE command with no parameters. Let us assume the following NET USE commands were issued prior to displaying the connection list: NET USE F: SERVER1C: NET USE G: SERVER1PAYROLL NET USE LPT1 SERVER1LASER NET USE COM1 SERVER1COMPORT The above NET USE commands connect the F: drive to the server’s C: drive, the G: drive to the server’s C:ACCOUNTS directory known as PAYROLL. The LPT1 was also connected to the server’s LASER printer. Finally, we connected to the server’s serial port known as COMPORT using COM1. To verify the status of all network connections, type the following command: NET USE This will display a list similar to the following: In this case, it is obvious that all the NET USE commands were successful.