加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Map a Network Drive and MKLINK Command

(2011-06-17 03:39:55)
标签:

it

分类: 工作

Maping a network drive:

Maping a network drive to your server is easy.
1. Click Windows Start Button, Computer
2. Click Map network drive (I know….  It was hidden 
3. Select the Drive Letter, Type or Browse to the Server Share, Check Reconnect at Logon Box if you want the Mapping to be persistent (remain after a reboot).  Click Finished when finished.

Just make sure that you check the box that says to reconnect at logon so that the map re-appears if the
system is rebooted. You could also put a net use command in the appropriate start-up file depending on when the app needs acess to the drive (at boot-up or at logon) or use GPO to handle it in the user's logon script.(Use GPEDIT.MSC to add a logon script to the server.)

net use q: \\server\share password /user:domain\username /persistent:yes

--------------------------------------------------------------------------------

Symbolic Links:

Mklink is a MS Windows command line utility that you can use to create symbolic links or symlinks and hard links in MS Windows. Mklink is a nice tool for troubleshooting file system problems. Mklink requires administrative privileges.

This page relates to explaining the difference between symbolic links and hard links on the Difference between symbolic link and hard link page.

Map <wbr>a <wbr>Network <wbr>Drive <wbr>and <wbr>MKLINK <wbr>Command

First, let's introduce the mklink command. You can see it in the following print screen:

It is pretty self-explanatory. Now, let's take a look at an example.

Mklink example
The print screen shown below demonstrates creating symbolic links, hard links, and shortcuts in MS Windows and how they differ.
Map <wbr>a <wbr>Network <wbr>Drive <wbr>and <wbr>MKLINK <wbr>Command

Symbolic link:

•Created as mklink link_name target_name
•The icon next to the link is the same like that of a shortcut
•Occupies zero space in the system
•It is not a separate file in the file system
•Interpreted at the operating system level
•If the original file is deleted, the link is useless
•Removing the original file does not remove the symbolic link
•Removing the symbolic link does not remove the original file
Hard link:

•Created as mklink /H link_name target_name
•The space it occupies equals the size of the original file, but refers to the same object in the system (not a copy)
•Interpreted at the operating system level
•The icon next to the hard link is different from the other objects
•Removing the original file does not remove the hard link
•Removing the hard link does not remove the original file
•If the original file is deleted, its content is still available through the hard link
•Making a change to the hard link propagates all changes to the original file
Shortcut:

•Created by right clicking the original file and selecting action from the drop down menu
•A file in the system that is completely separate from the original file
•Only those programs that know the concept of shortcuts understand them
•If the original file is deleted, the link is useless
•Removing the original file does not remove the shortcut
•Removing the shortcut does not remove the original file
The print screen below shows these concepts.

Linux uses a similar command called ln.

Mklink in Windows versus Ln in Linux
Note, the mklink syntax is a bit different from the Linux ln syntax (ln is used in Linux to create links).

Mklink: The name of the link is followed by the name of the target in the mklink command syntax. If you do not specify any flag, the mklink utility creates a symbolic link by default.

Ln: The name of the target is followed by the name of the link. If you want to create a symlink, you have to specifically include the -s flag.

Example:

mklink /d \MyDocs \Users\User1\Documents

 

Remove symbolic file link

del <link-name>

remove symbolic directory link

rmdir <link-name>
----------------------------------------------------------------------------------

Virtual Disk Drives

Microsoft Windows allows you to define virtual disk drives? Any drive letter that is not currently used to represent a physical drive can be defined as a virtual drive. What is a virtual drive? It’s a folder of a physical drive that acts like it is a separate drive, unto itself. Some reasons you may a want, or need, to do this are:

•As a handy shortcut.
•Because some software requires it.
•In a batch file, so that the path only needs to be referenced once at the top of the batch file, and therefore could be easily changed later, if need be.
Pretend that you have a file folder called C:\data\word_docs, that you use it constantly, and that you would like to refer to it with a shortcut of W:. Open up a command prompt window and issue the following command:

SUBST w: C:\data\word_docsSUBST is short for substitute. (DOS commands are case-insensitive, so you could enter it as “subst” as well.) So, now, W:\intro.doc is the same thing as C:\data\word_docs\intro.doc — two different ways to refer to the same file.

If you ever move the folder, and want to change the shortcut, just reissue the SUBST command:

SUBST w: D:\new_location\word_docs
Virtual drive definitions are permanent, until explicitly released. If and when you decide you’re not using it anymore, the command to remove the association is:

SUBST w: /DTo find out what virtual drives are currently defined, just type SUBST on a line by itself:

SUBSTImportant: Be aware that when deleting any files via a virtual drive letter reference, the files are deleted immediately, bypassing the recycle been. So, in the example above, if you were to delete C:\data\word_docs\intro.doc, it will go to the recycle bin, but if you were to delete it by referring to it as W:\intro.doc, then it would not be recycled

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有