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.

JW0914
  • 9,096
Toby Allen
  • 3,123

7 Answers7

126

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

JW0914
  • 9,096
William Hilsum
  • 117,648
12

It runs ok for me:

net use \\\server\share\folder1\folder2
mklink /d "C:\Users\Admin\test\mi_enlace" \\\server\share\folder1\folder2
phuclv
  • 30,396
  • 15
  • 136
  • 260
8

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.

3

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
  • 365
0

in Windows 10 Pro, I tried two ways:

first:

mklink C:\folder \\server.local\SHARE\folder

second:

assigned \\server.local\SHARE to P: (which I confirmed I can browse its contents in File Explorer) and tried:

mklink C:\folder P:\folder

and I can’t cd into C:\folder either way.

While I really would prefer to script using mklink, my workaround is to use the Link Shell Extension which worked for me the first time:

https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html

Works great on Windows 11 as well.

Hope it helps someone else out there who has trouble with mklink

-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
)
Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
Bob
  • 5
-2

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.