Net.AddCon (method)

Syntax

Net.AddCon NetPath,Password,LocalName [ ,[UserName] [,isPermanent]]

Description

Redirects a local device (a disk drive or printer queue) to the specified shared device or remote server.

The new syntax does not affect previously compiled code.

If Password is not specified, then the default password is used. If empty, then no password is used.

If LocalName is not specified, then the a connection is made to the network resource without redirecting the local device.

The UserName parameter specifies the name of the user making the connection. If UserName is not specified, then the default user for that process is used.

The isPermanent parameter specifies whether the connection should be restored during subsequent logon operations. Only a successful connection will persist in this manner.

Comments

The Net.AddCon method takes the following parameters:

 

Parameter

Description

 

netpath$

String containing the name of the shared device or the name of a remote server. This parameter can contain the name of a shared printer queue (such as that returned by Net.Browse[1]) or the name of a network path (such as that returned by Net.Browse[0]).

 

password$

String containing the password for the given device or server. This parameter is mainly used to specify the password on a remote server.

 

localname$

String containing the name of the local device being redirected, such as "LPT1" or "D:".

 

A runtime error will result if no network is present.

Example

This example sets N: so that it refers to the network path SYS:\PUBLIC.

Sub Main()

  Net.AddCon "SYS:\PUBLIC","","N:"

End Sub

See Also

Net.CancelCon (method); Net.GetCon$ (method)

More information

N