HTB Knowledge Base Software Logo  
HTB Knowledgebase
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home | Login Members Login | Knowledge Base Glossary Glossary
Home > All Categories > Vista Tips > Using Symlinks in Windows Vista
Question Title Using Symlinks in Windows Vista
One of the long-awaited features in Windows Vista was the ability to use symbolic links, the way you can in linux. Sadly, they don't work quite as well as they could, but it's a big upgrade from prior versions.

Using the mklink Command

The command that you need to use is mklink, which you'll use from the command line. Just type it on the command line to see the options:
C:UsersmklinkC:Users> 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. -> 
For instance, if you wanted to make the folder C:UsersUserTestFolder available from C:TestFolder as well, you could use the following command. ->

C:mklink /D C:TestFolder C:UsersuserTestFolder
symbolic link created for C:TestFolder <<=== C:UsersuserTestFolder
Now if you look in C:TestFolder directory, you'll see whatever files were in the other directory.

symbolic link created for C:TestFolder <<===>
symbolic link created for C:TestFolder <<===>>
Understanding the Options
MKLINK link target
Using the command without any extra options creates a soft link to a file.
/D creates a symbolic link, or a soft link.
This essentially acts like a shortcut to a folder in prior versions of Windows, except you don't have to use an actual shortcut.

/H creates a hard link, which points directly to the file.
This option can't be used for folders directly for some reason, you'll have to use the next option.

/J creates a "Directory Junction"
A Directory Junction is actually just a hard link to a directory. This is a feature that existed prior to Vista as well. If you are trying to symlink to a directory using a hard link, then you should use this option.

Understanding Hard vs Soft Links
Hard Link A hard link directly points to the file, and acts to the operating system as if it is the file itself. You'll want to use this option the majority of the time if you are trying to fake an application's directory.
Soft Link A soft link is essentially a shortcut to a file or folder - if you are using Windows explorer, you'll be redirected to the directory if you double-click on a shortcut, it won't pretend its part of the filesystem. You can still directly reference or open a file with the symlinked path, and it mostly works.

Using Symlinks from a Network Share
One of the things that's been extensively discussed is that you cannot use the Vista symlinks from another operating system (not surprising), but you cannot use them from a network share either. This is troublesome if you expect to use this feature on a web server or a file server.
Deleting Symlinks

To delete a symlink, you can just delete the link. Just make sure you don't delete the original file.
Click Here to View all the questions in Vista Tips category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
Related Questions Related Questions
  1. How to set up Gmail IMAP Support for Windows Vista Mail
  2. Windows Vista temp files directory - manually clean up
  3. What is jusched.exe And Why Is It Running?
  4. How to view last modified files on Windows Vista
  5. How to assign a shortcut key to the Snipping Tool in Windows Vista
  6. How to enable mapping on Windows Vista
  7. How to find files within a date range with Windows Vista Search
  8. Adding tags using the Details Pane
  9. How to bypass multitasking and speed up your PC - Set Affinity
  10. Windows Speech Recognition
  11. Print pages in Internet Explorer 7 without headers or footers
  12. Add an application to the Quick Launch menu in Vista
  13. How to add Home Directory icon to the desktop in Windows Vista
  14. How to keep Start menu from closing after opening applications
  15. Personalized views of your files
  16. How to change Internet Explorer in Windows Vista to search Google by default
  17. How to change the default action for power button
  18. How to disable UAC prompts for Administrators Only
  19. How To Delete Your Windows Vista Logon Password
  20. How to verify the integrity of Windows Vista system files
  21. Show hidden files and folders in Windows Vista
  22. Advanced Search Pane
  23. How to create a restore point for Windows Vista's System Restore
  24. Save 15 Keystrokes - Use Ctrl+Enter to Complete URL
  25. Automating your Windows Vista defragmentation routine
  26. How can I tell if my computer is up to date?
  27. How to disable automatic startup programs
  28. Snip at Will - How to make screen shots easier
  29. Prevent Vertigo on Vista
  30. Instant Search
  31. How to utilize User Activity Reports to determine which Parental Controls to use
  32. How to customize the Manufacturer Support Info in Windows Vista
  33. Windows Sidebar (overview)
  34. How to add "My Computer" to your Vista taskbar
  35. How to make UAC stop blacking out the screen in Windows Vista
  36. Reduce Power Consumption
  37. Gain Speed
  38. Search Folders
  39. Save Your Music!
  40. How to change Start Menu to use small icons in Windows Vista
  41. How to resize your Windows Vista desktop icons
  42. Boost Your System Speed with an USB drive
  43. How to disable User Access Control (UAC)
  44. Get help
  45. How to block spam from International senders in Windows Vista Mail
  46. Go International - How to see multiple time zones
  47. Restore your files
  48. How to enable hidden bootscreen in Windows Vista
  49. Turn automatic updating on or off
  50. Enhanced column header controls
  51. Move Your Personal Stuff
  52. Quickly open network connections list in Windows Vista
  53. How to fix problems with copying large files in Windows Vista
  54. How to resize icons quickly in Windows Vista Explorer
  55. Adding tags when opening or saving a file
  56. Uncover Send To
  57. Improve Your Network
  58. How to select files using check boxes in Windows Vista
  59. How to copy path of a file to the clipboard in Windows Vista
  60. How to Create a Windows Vista Logon Password
  61. How To Automatically Log On To a User Account in Windows Vista
  62. How to add Internet Explorer icon to Windows Vista Desktop
  63. Show hidden files and folders in Windows Vista
  64. Troubleshoot browsing issues by reloading the DNS client cache in Vista
  65. How to disable System Restore in Windows Vista
  66. Tagging your files
  67. "Up" keyboard shortcut for Windows Vista Explorer
  68. Create a shortcut or hotkey for the Safely Remove Hardware dialog
  69. View hidden 3D benchmarks in Windows Vista
  70. I donít like the look of Vistaís Aero theme. How can I change it?
  71. How to create exceptions in Windows Vista Firewall
  72. What are the Differences between the Vista Versions? - Overview
  73. Stack and Group By views
  74. Built-in Quick Launch hotkeys in Windows Vista
  75. Enable quick search in folders on Windows Vista
  76. How to enable Ctrl+Alt+Delete for Vista Logon Screen
  77. How to create a shortcut on the desktop to Lock Windows
  78. How to resize a partition in Windows Vista
  79. Make Ctrl+Tab in Internet Explorer 7 use most recent order
  80. Turn on Remote Desktop in Windows Vista
  81. How to copy path of a file to the clipboard in Windows Vista
  82. Why do my Windows Vista fonts look horrible?
  83. How to share a folder the XP way in Windows Vista
  84. Visual clues when copying or moving files in Vista
  85. Make Windows Vista stop asking for password when resuming from Sleep
Article Information Additional Information
Article Number: 704
Created: 2008-09-17 4:59 PM
Article Options Article Options
Print Question Print this Article
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Search Knowledge Base Search Knowledge Base

Powered by HTB Knowledge Base Software