Mapping common drives for all users allows you to present a central resource location for applications or data. To map a network drive and display the status from the command prompt, proceed as follows:
- Create a new directory to store all files included in this example.
- Select Start|Run and enter “scriptfile.bat.”
Here, scriptfile is the full path and file name of a script file that contains the following:
@Echo Off
CLS ; Clears the screen
Set Drive=DriveLetter
Set Share=\\server\sharename
Echo Mapping drive %Drive% to %Share%
Net Use %Drive%: /Delete && CLS
Net Use %Drive%: %Share%
If %errorlevel% EQU 0 CLS && Echo Map Successful && Goto End
CLS && Echo Error mapping drive %Drive% to %Share%
:End
Here, driveletter is the drive letter to map a share to, and server contains the sharename you want to map to.