Win7 How to create a soft link

Source: Internet
Author: User

Mklink target file source files (files that need to be soft-chained)

Soft links in Win7 (Mklink command)

Post by Ironwood Box in technical talk on 2011-05-24 13:13.ReviewsComments (2)Read (13,399)[Reprint statement]Reprint must be marked: This article is from Ironwood box blog http://www.mzone.cc
[Address of this article]The permanent address of this article is: http://www.mzone.cc/article/619.html

Linux friends know that there is a concept of soft links in Linux, you can create a soft link to a directory or a file through the ln command, the advantage of soft links is that a directory or file can have multiple portals but maintain a single physical location, easy to apply and manage. Creating a soft link under Linux generally uses the following command:

 
   
  
  1. # LN-SF File1 file2
  2. Where File1 is the name of the software link, file2 is the path to the actual file and can be accessed by file1 in the future file2

It has been plagued by Windows without similar features, causing some places to be inconvenient, but after entering the Windows Vista and Win7 era, such features are also included with Windows, and a similar soft link can be created via the Mklink command in the Win7 operating system.

  
 
  1. D:\temp>mklink /?
  2. Creates a symbolic link.
  3. MKLINK [[/D] | [/H] | [/J] ] Link Target
  4. / D Create a Directory symbolic link. Default to File
  5. Symbolic links.
  6. / H creates a hard link instead of a symbolic link.
  7. / J Create a directory join.
  8. LINK Specifies the new symbolic link name.
  9. TARGET specifies the path of the new link reference
  10. ( relative or absolute ).

Above is the help information of the Mklink command, you can see that mklink can create directories and file links. For example, D:\temp directory has a directory dir1, I want to create a soft link to the Dir1 directory under the current directory, you can use the following command to operate:

 
   
  
  1. / D Dir2 Dir1
  2. / J Dir3 Dir1

The above two commands can be implemented to Dir1 soft links, parameters/D and/j is to create a directory soft link must, at present, two parameters can be implemented directory soft link, and the application process also found no difference between the place, the only difference is the type of DIR2 and dir3 links do not understand, The dir command can be used to view the results as follows:

  
 
  1. 2011 / 05/ 17 Span style= "color: #000000;" >14 : < dir> Dir1
  2. 2011 / 05/ 24 Span style= "color: #000000;" >13 : < junction> dir2 ]
  3. . //: <symlinkd> dir3 [dir1]

We can see that Dir1 is the Dir type (this is the actual directory we created), Dir2 is the junction type, and Dir3 is the SYMLINKD type, this may be the difference, but the effect is the same in the application.

After the directory soft link, the file can also create a soft link, but also can create a hard connection, such as the D:\temp directory has a abc.txt file, I want to create a soft link to this file command as follows:

 
   
  
  1. Mklink Abc1.txt Abc.txt

So we created a soft link to the Abc.txt file Abc1.txt, for the file can also create a hard link, hard link personal feeling is not useful, because the creation of hard links is the space on disk is doubled, for hard links, modify the hard link file and the contents of the original file will affect each other, that is, the content is consistent, but the space consumption is accurate It's a double-copy. Use the following command to create a hard link:

 
   
  
  1. / H Abc2.txt Abc.txt

The types of soft links and hard links for files are viewed as follows (with the dir command):

  
 
  1. . //:7 abc.txt
  2. 2011 / 05/ 24 Span style= "color: #000000;" >13 : 30 < Symlink[ abc.txt
  3. . //:7 abc2.txt

There is no difference between a hard link and a normal file, the only difference being that the modified content directly affects the original file.

Basically the soft link creation and basic knowledge of the Win7 system is introduced here, what is the use of these, for example, we often develop PHP programs under Windows, and PHP programs need to run under Apache, In general, we need to modify the Apache Htdocs directory or put the code in the Htdocs directory to run. But with a soft link, we can create a directory soft link in the Apache Htdcos directory to the actual development directory, so that our code development can be directly in Apache Preview Update, of course, you can also use this technology in any other desired place.

Incidentally, the soft link directory and files can be deleted directly, will not affect the original directory and files, this is also very convenient, and the soft link directory and file icons have a small arrow, very good distinction.

Technical TalkLinux, Ln, Mklink, Win7, windows, hard links, soft links

Win7 How to create a soft link

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.