Hardlinks, Junctions, Symlinks to files or folders

Very underused feature of Windows 7 (NTFS).

c:\TEMP\test\folder1>mklink

MKLINK [[/D] | [/H] | [/J]] LinkName Target

/D Creates symbolic link (symlink) to a folder. Default is a symlink to a file.
/H Creates hardlink instead of a symlink.
/J Creates junction.

LinkName Defines name of the new symlink.
Target Defines path (relative or absolute) the new symlink points to.

There’s at least one circumstance where you can’t replace a junction point with a symlink: if the content might need to be accessed remotely. If you access a file share on a Windows machine, junction points are interpreted by the server and work as expected. Symbolic links are interpreted by the client (i.e., a symlink to c:\foo\bar would be interpreted as pointing to the client’s C drive) and are disabled by default anyway.

Link a folder to a server share
D:\DATA\FOLDER1\FOLDER2>mklink /d LINKNAME \\server\share

Have you got skydrive installed in your profile? Then folder C:\Users\UserName\SkyDrive is synchronized to SkyDrive. If you want another folder on D: drive (ie D:\Tools) also synchronized to SkyDrive just make a symbolic link to it and you’re done.

C:\Users\UserName\SkyDrive\Programs>mklink /d tools d:\tools

Advertisements

Tagged:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

smsagent

Tips, tricks and time-savers for the Windows and ConfigMgr administrator

To The Point

Anything about Technology and Business

Brian's Power Windows Blog

Microsoft in the Enterprise. Windows, Hyper-V, Exchange, SQL, and more!

PowerScripting Podcast

Shownotes and links for the PowerScripting Podcast, a podcast to help people learn Windows Powershell

Learn Powershell | Achieve More

What is this Powershell of which you speak?

%d bloggers like this: