How to change the path of a mapped drive in win7?

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.


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.

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.