How do I mount a network drive to a folder?

75

30

Does anyone know of a third party (or even windows native) solution to this simple problem?

I want to map an internal network share on our windows server to a folder on each of the client machines in the network. I don't want to to use drive letters; I would just like to set up a folder on my C drive that is actually a Windows share. For example, C:\Data\Network Docs should actually point to \Server\SharedData.

Is this possible? Is there any tool that does it? All clients are using Windows XP and Windows 7.

Toby Allen

Posted 2011-02-11T15:03:16.310

Reputation: 2 634

1please update for windows 10 also – userJT – 2017-11-01T13:51:35.313

1

Related: Mount Remote CIFS/SMB Share as a Folder not a Drive Letter on Server Fault.

– Cristian Ciupitu – 2018-09-19T09:18:55.043

Answers

96

In Windows Vista or Windows 7, you can create a "junction folder"/"Symbolic link" to redirect the contents of one to another.

Simply type:

mklink /d "c:\data\network docs" "\\server\shareddata\"

I have not tested it with a FQDN, but as far as I can tell, it should work. I have tested it with a network mapped drive, and this works perfectly... so at a last resort, you can map first, then do this.

The /d creates a directory (c:\data\network docs in this example) and it must not exist. It will be created by this command.

You must have admin privileges when you run CMD. You can do this under an admin account by pressing ctrl-shift-enter instead of enter when you run CMD.

The end result is also achievable in Windows XP, but it is not as easy. Guide here

William Hilsum

Posted 2011-02-11T15:03:16.310

Reputation: 111 572

10This is a symbolic link, not a junction link, there is a difference. – Cestarian – 2016-04-13T11:53:33.427

1what about win 10? – userJT – 2017-11-01T13:52:17.627

@Nick That is not true; one may absolutely make a junction point in Win 7, using mklink with the /j switch. This is clear from the help output: mklink /? That said, one may not make a junction (reparse) point from a local disk to a network resource; junctions work on local volumes only, which is why the \d switch is required in this instance. – Ben Johnson – 2018-05-04T16:03:31.447

@BenJohnson yes - sorry to not be clear - I meant to say that you can't make junctions between local folders and network folders and you need to do a symlink instead. – Nick – 2018-05-18T16:41:44.757

Please delete any mention of "junction". Mount points (i.e. junctions) are not allowed to target remote filesystems because they're defined to be evaluated on the server side, as opposed to symlinks, which get evaluated on the client side. In this way and other ways, mount points and symlinks do not behave the same and are not intended for the same use cases. Mount points are not legacy/outdated symlinks. They have a specific place in the overall scheme of things. Also, this answer should mention L2R (local to remote) symlink policy, which may disallow following symlinks with remote targets. – Eryk Sun – 2020-01-04T13:49:02.730

5Note that for Windows XP, the linked guide explicitly says, "you can’t create a junction point on an NTFS drive that points to a network drive." (for Windows XP) – Bill – 2012-11-13T16:41:38.823

3Adding to @Bill's comment. You can't make a junction point in Win7, etc either, but the mklink tool functions like a symbolic link. If you try to use a junction (ie, using the Sysinternals junction tool), it will make the junction, but will not function. – Nick – 2013-09-26T02:45:39.410

1Works for Windows 8.1 as well. Make sure to run the command prompt with administrative privileges. – dave k – 2013-10-25T20:21:45.107

9

It runs ok for me:

net use \\\server\share\folder1\folder2
mklink /d "C:\Users\Admin\test\mi_enlace" \\\server\share\folder1\folder2

Justo Antonio Garrido Herrdor

Posted 2011-02-11T15:03:16.310

Reputation: 91

1will this persist over months and years (reboots?) (I am currently using map network drive to letter but would prefer mapping to folder) – userJT – 2017-11-01T13:52:58.237

2

This is an example fore the solution already provided by William Hilsum

open cmd
type: cd \folder-parent-of-the-folder-to-clone
type: deltree folder-to-clone (or you will get the following error: Cannot create a file when that file already exists)
type: mklink /d "folder-to-clone" "g:
\folder-to-clone"
The software will prompt: symbolic link created for folder-to-clone <<===>> g:\folder-to-clone

Revious

Posted 2011-02-11T15:03:16.310

Reputation: 303

0

For PowerShell:

(Remember to run as Administrator!!!)

New-Item -ItemType SymbolicLink -Path "C:\Somewhere At SMB Client" -Target "\\SMB-SERVER\Somewhere"

And if you want to delete it, simply delete it in File Explorer. DO NOT CALL rm OR del in PowerShell, as it would delete all the files. Instead, cmd /c "rmdir C:\Somewhere At SMB Client" or (Get-Item C:\Somewhere At SMB Client).Delete() would do the trick.

march_happy

Posted 2011-02-11T15:03:16.310

Reputation: 26

-2

If you use a junction switch then there is no need for admin mode.

mklink "c:\data\network docs" "\\server\shareddata\" /j

Hence on your netlogon script you use a condition

where if exist "c:\data\network docs" (
goto next
)else (
mklink "c:\data\network docs" "\\server\shareddata\" /j
)

Bob

Posted 2011-02-11T15:03:16.310

Reputation: 5

9Attempting to use a junction in such a way results in a "Local volumes are required to complete this operation" error. – EAMann – 2014-07-12T20:03:52.780

-2

Create a shortcut to a folder and modify it to point to \\Server\SharedData. Then rename it to whatever you want.

still thinking about it

Posted 2011-02-11T15:03:16.310

Reputation: 13

1A shortcut can't be used like a normal folder so this won't work to do what they are requesting. – Steve Hiner – 2016-08-03T18:38:03.643

Point taken. I was still a beginner at that point! i needed to get some reputation points for a course i was doing. – still thinking about it – 2018-08-16T06:53:45.757

Courses require S.E rep??!! – Mawg says reinstate Monica – 2020-01-17T06:59:53.210