<转贴>使用NTFS的连接点移动Document and Setting

由于Windows使用documents and settings存储了大量内容,单纯使用profile的方法不能够移走documents and settings 目录,因为很多动态库在注册表中记录了documents and settings 目录的绝对位置。

  当2000,xp,2k3中的ntfs5多了一个新特性,就是连接点,可以象linux下面那样直接mount一个分区到一个ntfs5的目录上,也可以在ntfs5上生成一个目录或者文件的符号连接这里有两个命令可以使用,一个是 mountvol (这个命令是windows 自带的),就是mount一个分区到一个ntfs的目录上,而且只能mount分区,另一个命令是linkd.exe,是windows的资源工具箱中的,可以在微软下载:http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en。这个命令可以把 ntfs分区上的 document and setting 目录 映射到另一个分区的某个目录。

  使用 mountvol 的方法:
  首先运行mountvol,获得需要mount的卷名称,如
   \\?\Volume{ef2c5830-890a-11d8-9112-806e6f6e6963}\
C:\
\\?\Volume{ef2c5831-890a-11d8-9112-806e6f6e6963}\
D:\
\\?\Volume{ef2c5832-890a-11d8-9112-806e6f6e6963}\
E:\


  假设系统在c盘,要把documents and settings目录移动到D盘然后 写下如下的脚本

xcopy "c:\documents and settings"  D:\   /S /E /H
ren "c:\documents and settings"  "c:\documents and settings.bak"
md  "c:\documents and settings"
mountvol  "c:\documents and settings"   \\?\Volume{ef2c5831-890a-11d8-9112-806e6f6e6963}\

  把如下的脚本放到开机脚本去运行,输入“gpedit.msc”后回车,打开组策略编辑器。依次展开“计算机管理→Windows设置→脚本(启动/关闭)”,双击启动项,然后添加,然后重新启动,这样 你的"c:\documents and settings" 就被定向到 D盘了。ps: 上面的开机脚本 只要执行一次,冲启动后,记住 删除该脚本。

  使用 linkd.exe的方法:优于mountvol的方面是: linkd 可以把"c:\documents and settings" 目录 映射到d盘的某个目录,而不是d盘。

  linkd 的命令很简单 :用下面的命令替换前面脚本中 mountvol的部分就可以了,xcopy需要相应的修改,其他不变

linkd "c:\documents and settings"  d:\xxxxxxxxx
原文地址:https://www.cnblogs.com/pipisong/p/361047.html