I need to link a file to
How can I do that with Windows ? Is there a soft link such as
ln -s or equivalent in Windows ?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
There may be other ways, but the one I'm familiar with is mklink:
C:\>mklink Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link specifies the new symbolic link name. Target specifies the path (relative or absolute) that the new link refers to.
There are junctions but I don't know if this will do exactly what you need.
edit - oops sorry, junction only applies to directories not files
Link Shell Extension can create symbolic link (among other things). Nice context menu integration. Available for the most recents windows versions and frenquently updated.
As long as Microsoft advices to use powershell as a command interpreter since more than 5 years ago and
cmd.exe is becoming a legacy application this question lacks an answer in Powershell:
New-Item -path ~\Desktop\hosts -itemType SymbolicLink -target c:\Windows\System32\Drivers\etc\hosts
This works as of Powershell v5.0