How to map Windows password protected network drive automatically on Windows machine

 Windows Command :

net use x: \\server\share /USER:COMPUTER\User password

To connect/map any  network drive automatically when you reboot your system, you need to put this command in BAT file and run it with startup.

  1. Create mapDrive.bat file
    @echo off
    :: Delete already connected drive. (In case you run this bat file after login )
    net use X: /delete
    
    :: Now map/re-map network drive.
    ::COMMAND: net use x: \\server\share /USER:COMPUTER\User password
    net use X: \\192.168.1.1\SharedFolderName /USER:\username password
    
    ::net use X: \\192.168.1.1\SharedFolderName /USER:\domain\username password
    exit
  2.  Now create shortcut in Startup folder.
    1. Click on Start -> All Programs -> Startup
    2. Right click on Startup and select "Open"
      1. C:\Users\<USER_NAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    3. Right click on Right panel and select "Create Shortcut" option. (Available under "New" )
    4. Browse the location where you created mapDrive.bat and select it. Click OK->Next and Finish it.
  3.  To test this is working properly, just reboot your system. Your network drive should be connected automatically after reboot.


Comments

Popular posts from this blog

Selenium: File download handling.

Major Differences between Python and Java

Cypress V/S Selenium