Mapping to a network share in DOS
This section is mainly relevant to those who are studying networking. It is not required for a basic understanding of DOS. Mapping is the term given to assigning a local drive letter to a shared folder on another computer on a network. Examples of local drives (i.e. physically inside the workstation) are
A: - floppy drive
C: - hard disk
D: - CD-ROM drive
These drives are all assigned letters to help identify them. You can do the same thing on a network by allocating an unused letter to a network share.
Why bother?
Mapping a drive serves a number of useful purposes. If I wish to connect to a network share, say
\\Server\folder1 I can access this resource more quickly by just typing a letter than having to type the full
UNC path to that resource. If you're running an application from a network share, sometimes it's not possible to use a UNC path and a local drive letter is required.
What's a UNC path?
UNC stands for
Universal Naming Convention. This is the agreed standard for describing a shared network resource. It follows the
\\PCName\Sharename format. Two backslashes precede the name of the sharing computer, followed by another, single backslash and the name of the shared folder. This same UNC rule is used for mapping shared printers -
\\PCName\Printername. It's best to keep all sharenames to maximum eight characters with no spaces, for DOS compatibility.
Why not just do this in Windows?
You can, but you need to know how to do it in DOS too. Sometimes we don't have the luxury of the Windows GUI (Graphical User Interface), for instance when using Network-connecting boot disks. This is a skill no self-respecting DOS geek should be without.
OK you've convinced me, so what's the command?
So glad you asked. DOS (and Windows) use the
NET command to map drives. You should find NET.EXE in your Windows folder. Type
NET /? to get the
full lowdown. To map a drive using the NET command, type the following:
NET USE X: \\COMPUTERNAME\SHARENAME
I've chosen drive X: - but any free drive letter will do. Substitute the computer's name for
computername and the name of the share for
sharename. Note the colon after the drive letter and the spaces between
NET and
USE and
X: and the
UNC path. So to map a drive, let's choose the spare letter I: to a share called
andy on a computer called
love, we type:
net use i: \\love\andy
Automating for batch files
The username (and password) can be included in the command, to prevent prompting.
NET USE X: \\COMPUTERNAME\SHARENAME /USER:username password
This is useful in batch files where no user input and automated, background mapping of shares might be required.
What about the MAP command?
Good question. Although we talk about mapping a drive, you won't find a MAP.EXE in Windows.
That's because MAP is a Novell command. The Windows equivalent is NET.EXE
Type
NET
USE at the DOS prompt to get a listing of all currently mapped drives.
- AndyM