31

enter image description here

Now it's mapped to \\192.168.248.128,how to change it to \\192.168.66.2 instead?

0

3 Answers 3

60

If you want to use the command line have a look to the next answer below!

But you can also edit the settings in Windows Registry: 'HKEY_CURRENT_USER\Network\[Drive letter]'

When you now open a new 'My Computer' window - after changing the target in registry - you will likely see the old settings, but that is only a visual problem. Try to open the entry, and it should work!

Have a look to Chris Budys interesting comment below, that fixes obviously the visual problem.

2
  • 6
    +1. This IS an answer to the question "How to change ...". Commented Feb 19, 2014 at 10:53
  • 4
    This answer put me on the right path, and if you do a find in the registry for the path you are changing you will find a few more locations that can be updated: * HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU * HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##0.0.0.0##ShareName After updating all of those everything works as expected and displays properly as well.
    – Chris Budy
    Commented Jan 19, 2015 at 0:54
34

net use can modify a drive in place without deleting and recreating. You simply execute the command as if you're mapping a new drive, and it replaces it instead. The command syntax is:

net use [Drive name] [UNC path]

Example:

C:\> net use U: \\192.168.66.2
U: has a remembered connection to \\192.168.248.128. Do you
want to overwrite the remembered connection? (Y/N) [Y]: y
The command completed successfully.
1
  • 3
    This should really be turned into the accepted and/or most upvoted answer. It's correct, does exactly what the OP asks, doesn't requiring searching registry key(s) or multiple steps and as such is also pretty much the fastest way to get there.
    – stijn
    Commented Jul 24, 2019 at 7:39
7

You can create another mapped network drive:

  • right-click the current drive and click "Disconnect"
  • right-click "Computer" and select Map Network Drive
  • configure the new drive

If you want Windows API you can use WNetAddConnection2.

If you want a BAT (command line) you can try net use command line option.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.