Mount Remote CIFS/SMB Share as a Folder not a Drive Letter

3,324

Solution 1

Just to map a network share directory you would use this command:

net use \\Server\ShareName\Directory

This mapping would:

  • not be persistent
  • would have to be established and authenticated at user login
  • you would access the share using the UNC path, and not a local drive letter

If you want to access the network share through a location on your local C: drive, you'll want to set up a symbolic link:

mklink /d  C:\Folder\ShareName \\Server\ShareName\Directory

Now when you navigate to C:\Folder\Share you'll see the contents of \\\Server\Sharename\Directory. You'll still need to provide authentication for the resource with something like net use (or just be logged into a domain account on a domain system that has access) otherwise the link will probably error out angrily.

Solution 2

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/mountvol.mspx?mfr=true

From the horses mouth:

If you are running out of drive letters to use, mount your local volumes with no drive letters.

Solution 3

Click "Start", then click Computer. You're now in 'My Computer/Explorer'.
Right-click Computer, and click "Add a network location"
Then enter the server and share you would like to connect to

\\[servername]\[sharename]
Share:
3,324

Related videos on Youtube

Anagoge
Author by

Anagoge

Updated on September 17, 2022

Comments

  • Anagoge
    Anagoge over 1 year

    My dispatcher servlet maps to the root of the app.

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    

    I have a folder called 'static' in my webroot. It contains CSS, JS and image files. However, because of the dispatcher servlet mapping, the requests for static contents end up in 404s.

    I know the solutions lying around to address this.

    1. Make dispatcher map to a more specific URL, say :context:/app/, and then write a filter to intercept requests, and map conditionally to the default servlet, or else delegate to the spring dispatcher.

    2. The URL rewrite trick.

    3. using <mvc:resources />

    Problem is, my mappings are XML based, and I will absolutely not scatter my mappings config all over the place in the name of using annotations. So if I use <mvc:resources />, my xml based mappings break, and all url mappings to different controllers are lost.

    This is becase <mvc:resources /> overrides some settings and applies its own. But it is also the cleanest solution for static content.

    Any way available to tell <mvc:resources /> to not override my xml based mappings?

  • Anagoge
    Anagoge over 14 years
    I'm not sure I understand... In my case, I'm not running out of drive letters - I just don't want to assign/create more drive letters. I'm also not seeing a way to make mountvol mount network shares (the VolumeName param apparently wants a GUID representing a local volume name, not a network share).
  • Anagoge
    Anagoge over 14 years
    This is kind of close, but it doesn't let me choose what folder to mount the share in. It seems to only allow "mounting" the share under "Network Location" in My Computer. Ideally, I could mount it in an arbitrary folder like C:\Folder\ShareName. Samba on Linux seems to allow this, so I was hoping that Windows did as well.
  • Nunya
    Nunya over 14 years
    You can not choose what folder to mount it in the way you can in Linux. You can however then create a shortcut to it on the desktop.
  • Admin
    Admin almost 12 years
    Then that creates other problems. This url will work: :appcontext:/abc/def/something.do, but this will not work: :appcontext:/abc/def/ - my hub (or landing) urls will not work anymore.
  • Quandary
    Quandary over 11 years
    @OrangeDog: Symbolic links are supported on NTFS file systems only and are available in Windows Vista, Windows Server 2008 and Windows 7. In other words: If you use XP, you have to upgrade.
  • OrangeDog
    OrangeDog over 11 years
    @Quandary: Yes, I know. The question was whether there's a solution that doesn't use symbolic links (junction points perhaps?) that would work on XP.
  • dorbar
    dorbar almost 11 years
    @Bob That would do ONLY if you want a shortcut. (more here: http://stackoverflow.com/questions/4339220/is-there-a-way-to‌​-map-a-unc-path-to-a‌​-local-folder) But if you need a "working folder" the one some app could use you're, well we're out of luck. Bottom line you CAN NOT do a mapping of a network folder to a local folder only to a local disk! Again... according to Microsoft. Unfortunately...
  • Admin
    Admin almost 10 years
    Once the shortcut is created as suggested by Nunya, right click on the shortcut and copy to the clipboard. Go to the folder where you would like to access the share and paste. The shortcut to the remote share is added.
  • Eric Smith
    Eric Smith about 9 years
    You can mount local drives as a folder, like in Linux, without needing to create a link, by using Volume Mount Points: technet.microsoft.com/en-us/library/cc938934.aspx I'm not sure whether there's any way to mount a share in a similar manner.
  • Mathieu K.
    Mathieu K. over 3 years
    @user2227730, that appears indeed to be merely a shortcut. Browsing files one or two levels down shows the \\host\sharename\subfolder format. Thus, not a solution.
  • Mathieu K.
    Mathieu K. over 3 years
    @EricSmith, nope. mountvol (and the GUI equivalent) are for local drives. Trying with SMB shares gives me The parameter is incorrect.
  • Mathieu K.
    Mathieu K. over 3 years
    @OrangeDog, I'm a bit late to the party here, but junction points don't seem to work with SMB shares: mklink /j C:\localmountpoint \\server\sharename gives Local volumes are required to complete the operation.
  • OrangeDog
    OrangeDog over 3 years
    @MathieuK. fortunately I stopped using Windows XP quite a white ago
  • Mathieu K.
    Mathieu K. over 3 years
    @OrangeDog, sure, but junction points don't work on folders across all versions of Windows as far as I can tell—so they won't work on XP, and they don't work now.
  • Mathieu K.
    Mathieu K. over 3 years
    This answer is correct in the second part, starting at "If you want to access the network share through a location on your local C: drive". The first part (everything before that) is not the answer, and does not answer the question as stated. Please remove.
  • OrangeDog
    OrangeDog over 3 years
    @MathieuK.the only reason to use junction points is because XP didn't support symlinks. Otherwise just do what the answer says.