March 10th 1997 Mirror Sites ![]() Download the Software Network Card Drivers ![]() Features User's Guide Help ![]() Search Distribution Rights Listserv Shareware Links ![]() Order the Software Help Us Promote NetSoft LAN Dealer Enquires Welcome Home Page | http://www.netsoft.ie/ CHAPTER 3 The NET Command
NET Command Syntax Chart
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 / CONNECTThis 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 through LPT4, a serial port COM1 through COM4, or a logical drive A: through 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. NetSoft 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 DOSNET.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 read the Command Syntax In Depth. All NET USE commands are provided in a pop-up menu form using the DOS-NET Station Manager. The Station Manager (SM.COM) may be accessed through the DOS-NET Main Menu using the network keys CTRL+ALT+Right Shift simultaneously. Command Syntax In Brief Connecting to a network drive NET USE {d:} {\\computername\}[d:][password | *] Connecting to a network directory NET USE {d:} {\\computername\}[path][password | *] Connecting to a network drive using a network name NET USE {d:} {\\computername\}[network name] [password | *] Connecting to a network directory using a network name NET USE {d:} {\\computername\}[network name] [password | *] Connecting to a network printer or serial port NET USE {device} {\\computername\}[device] [password | *] Connecting to a network printer or serial port using a networkname NET USE {device} {\\computername\}[network name] [password | *] Disconnecting from a network drive or directory NET USE {d:} /d Disconnecting from a network printer or serial port NET USE {device} /d Displaying the connection list NET USE Command Syntax In Depth Connecting to a network driveThere are two methods of connecting to a network drive. The first is to specify the drive letter on the server you wish to connect to, the second is to connect to the network drive using a network name.The drive you wish to connect to must have been previously shared using the NET SHARE command from the server machine. Syntax: NET USE {d:} {\\computername\}[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: \\SERVER1\C: 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 nameSyntax: NET USE {d:} {\\computername\}network name] [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: \\SERVER1\MYDRIVE The advantages of using a network name over specifying which drive you wish to connect to, is that the server can change the drive it is sharing (e.g. 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 directorySometimes 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: \\SERVER1\C:\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 software will be F:\ not F:\ACCOUNTS. It is preferable to use a network name when connecting to the server's directory, rather than specify the target directory name. Connecting to a network directory using a network nameSyntax: NET USE {d:} {\\computername\}[network name] [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: \\SERVER1\PAYROLL Once connected to the server's C:\ACCOUNTS directory known as 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 on the server. The path to your software will be F:\ not F:\ACCOUNTS. The advantage of using a network name 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 machines NET USE command to match. The clients simply connect to whatever drive and directory is associated with the network name PAYROLL. This gives the server greater control of shared directories. Access rightsThe 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". PasswordsA 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 passwordsThe following command connects your F: drive to the directory known as PAYROLL on the server \\SERVER1, using the password SECRET.NET USE F: \\SERVER1\PAYROLL SECRET If the password is incorrect an error message will be displayed stating an "Invalid Password" was specified. Disconnecting from a drive or directoryWhen 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 printerThere are two methods of connecting to a network printer. The first is to specify the device name on the server that you wish to connect to. The second is to connect to the network printer using a network name.The printer you wish to connect to 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. Syntax: NET USE {device} {\\computername\}[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: \\SERVER1\LPT1 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 nameSyntax: NET USE {device} {\\computername\}network name] [password | *]To connect to the server's printer known as LASER using our LPT1, where the server's name is \\SERVER1, use the following command: NET USE LPT1 \\SERVER1\LASER Once connected, you may print as normal using LPT1 as your print device name. The advantages of using a network name over specifying which printer device you wish to connect to, 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 rightsAccess rights have no effect when using network printers.PasswordsA 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 passwordsThe following command connects your LPT1 to the server's printer known as LASER on the server \\SERVER1, using the password SECRET.NET USE LPT1 \\SERVER1\LASER SECRET If the password is incorrect an error message will be displayed stating an "Invalid Password" was specified. Disconnecting from a network printerWhen 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 our local LPT1. Connecting to a network serial portThere are two methods of connecting to a network serial port. The first is to specify the device name on the server you wish to connect to. The second is to connect to the network serial port using a network name.The serial port you wish to connect to 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} {\\computername\}[device] [password | *] To connect to a server's shared serial port COM1 using your COM1, where the server's name is \\SERVER1, use the following command: NET USE COM1: \\SERVER1\COM1 It is preferable to use a network name 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 nameSyntax: NET USE {device} {\\computername\}network name] [password | *]To connect to the server's serial port known as COMPORT using your COM1, where the server's name is \\SERVER1, use the following command: NET USE COM1 \\SERVER1\COMPORT The advantages of using a network name over specifying which serial port device you wish to connect to, 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 rightsAccess rights have no effect when using network serial ports.PasswordsA 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 passwordsTo connect your COM1 to the server's serial port (known as COMPORT) on the server \\SERVER1, using the password SECRET, use the following command:NET USE COM1 \\SERVER1\COMPORT SECRET If the password is incorrect an error message will be displayed stating an "Invalid Password" was specified. Disconnecting from a network serial portWhen 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 to the server's serial port known as COMPORT, use the following command: NET USE COM1 /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 listYou 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: \\SERVER1\C: NET USE G: \\SERVER1\PAYROLL NET USE LPT1 \\SERVER1\LASER NET USE COM1 \\SERVER1\COMPORT 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 on its LPT1. 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. TipsA maximum number of 40 NET USE commands may be performed.When configuring a client machine, set the number of MaxRedirections= parameter in the DOSNET.INI file to the maximum number that you are actually going to use. Setting the MaxRedirections= parameter to a large value wastes memory. On a server-only configured machine, the MaxRedirections= parameter in the DOSNET.INI file is automatically set to 0 to save memory, as server-only configurations cannot use remote network resources. NET USE commands should not be issued from your AUTOEXEC.BAT file. One or more servers you may be connecting to may not be powered on, or may not have the network software loaded, before you try to make your connections. Related Error Messages0Fh Invalid driveThe LASTDRIVE= parameter in your CONFIG.SYS file must be set to at least the highest value you will be using as your network drive. (e.g. if you wish to connect to a shared drive using your R: you must set the LASTDRIVE=R ). 33h Remote computer not listening The server machine specified for the \\computername parameter on the NET USE command line cannot be found. Ensure that you are using the correct \\computername and that its network cable is connected correctly. 35h or 43h Network name not found Occurs when trying to connect to a device, drive or network name on a server. Check your syntax and ensure that you are specifying the correct device, drive or network name. Also, check that the name has been shared on the server you are specifying using the NET SHARE command. 42h Network device type incorrect If you try to connect a local drive letter to a remote printer name or a local printer to a remote drive letter, check your syntax. 47h Network request not accepted Occurs when trying to NET USE a printer or serial port on a remote machine. This is because you have not loaded either PRNREDIR.COM or COMREDIR.COM on the client or server/client machine. 54h Too many redirections You have tried to redirect (connect to) too many devices across the network using the NET USE command, and exhausted the number of redirections specified in the MaxRedirections= parameter in the DOSNET.INI file. Either disconnect from one or more devices, or increase the value specified for the MaxRedirections= parameter in the DOSNET.INI file. 55h Duplicate redirection The local drive or device you are trying to redirect (connect using) is already connected (redirected) to a network drive or device. You must disconnect from the network before you can redirect a drive or device a second time. 56h Invalid password The password used on the NET USE command line was incorrect. Try again using the correct password for the device you are trying to connect to. For a complete description of all error messages see Chapter 18 "ERROR MESSAGES". [Chapter 4] [Chapter 2] [Table of Contents] [Home Page] | |||||||||||||||||||||||||||||
![]() | ![]() | ![]() |