98

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.

2

6 Answers 6

124

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

8
  • 5
    Note 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
    Nov 13, 2012 at 16:41
  • 3
    Adding 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
    Sep 26, 2013 at 2:45
  • 1
    Works for Windows 8.1 as well. Make sure to run the command prompt with administrative privileges.
    – dave k
    Oct 25, 2013 at 20:21
  • 12
    This is a symbolic link, not a junction link, there is a difference.
    – Cestarian
    Apr 13, 2016 at 11:53
  • 2
    what about win 10?
    – userJT
    Nov 1, 2017 at 13:52
11

It runs ok for me:

net use \\\server\share\folder1\folder2
mklink /d "C:\Users\Admin\test\mi_enlace" \\\server\share\folder1\folder2
1
  • 1
    will this persist over months and years (reboots?) (I am currently using map network drive to letter but would prefer mapping to folder)
    – userJT
    Nov 1, 2017 at 13:52
7

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.

1
  • 1
    You don't have to be an administrator if you create a link in a folder you control for a share you have access to - either with your own credentials, or after running net use \\computer\share sharepass /user:shareuser.
    – Guss
    Jul 28, 2021 at 11:46
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
-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
)
1
  • 10
    Attempting to use a junction in such a way results in a "Local volumes are required to complete this operation" error.
    – EAMann
    Jul 12, 2014 at 20:03
-3

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

Well, so far it has 5 down votes and 2 up votes so some people thought it was a useful trick! But agreed, it does not do the job exactly.

3
  • 1
    A shortcut can't be used like a normal folder so this won't work to do what they are requesting. Aug 3, 2016 at 18:38
  • Point taken. I was still a beginner at that point! i needed to get some reputation points for a course i was doing. Aug 16, 2018 at 6:53
  • 1
    Courses require S.E rep??!!
    – Mawg
    Jan 17, 2020 at 6:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .