Batch Script - NET USE


Advertisements

Connects or disconnects your computer from a shared resource or displays information about your connections.

Syntax

NET USE [devicename | *] [\\computername\sharename[\volume] [password | *]] 
[/USER:[domainname\]username] 
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name] 
[/SMARTCARD] 
[/SAVECRED] [[/DELETE] | [/PERSISTENT:{YES | NO}]]

where

  • \\computername\sharename − This is the name of the share which needs to be connected to.

  • /USER − This needs to be specified to ensure that the right credentials are specified when connecting to the network share.

Example

net use z: \\computer\test

The above command will connect to the share name \\computer\test and assign the Z: drive name to it.

batch_script_network.htm
Advertisements