Drive Mapping


 

 

Share Drive Mapping

There are couple of ways to map the shared drive in windows.

Using the GUI, the screen will guide you step by step to mount the drive however if we want to mount the drive using the command – we can use the windows command prompt to map the drive accordingly. 

Scenario 1:

Windows Command to Map the shared drive with the particular letter: 

Go to start – Search “cmd” – Right Click and Open as “Run as Admin”.

# net use x: “\\server\share“ /PERSISTENT:YES 

  • X: Name of the Drive 

Windows Command to Map the shared drive with the particular letter by using domainname and password.

Go to start – Search “cmd” – Right Click and Open as “Run as Admin”.

# net use x: “\\server\share“ /u:domainname\username password /PERSISTENT:YES 

  • X: Name of the Drive
  • U: username 

Scenario 2:

To map the shared drive in windows by using GUI method.

Go to start – File explorer – This PC – Select “Computer” tab in top of the window and Click “Map Network Drive”.

Mention the share drive path \\server\sharepath.

Click finish.

Scenario 3:

To delete the mounted drive in windows by using command prompt.

# net use /del x: 

  • X: Name of the Drive which is already connected

Scenario 4:

To delete the shared drive in windows by using GUI method.

Go to start – File explorer – This PC.

Expand “Network Location”

Connected or Mapped drives will be displayed.

Right Click on the Mapped drive and Click “Disconnect”.

 

Scenario 5:

How to create a batch script for mapping the drive.

Copy the below content (within **) by changing the required field in a text file and save as .bat

*****************************************

@echo off

net use x: “\\server\share“ /u:domainname\username password /PERSISTENT:YES

echo Mapped X drive

*****************************************

Note: If you are connecting the share with the local account, Username and password field is not required.

Scenario 6:

How to map the drive automatically when login into the system.

Every time when you login, you need to connect the shares automatically in your machine so follow the below steps:

Go to below location:

C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Note: 

  • %username% - mention your profile name.
  • To get the profile name, open the cmd, you can see the profile name “C:\Users\%username%>

Place the bat file which created in “Scenario 5” in the startup location.

Every time when you login into this profile, batch file will run automatically in your system.

 

Comments