在 Windows 7 中移动特定用户文件夹的脚本

Eva*_* M. 7 windows windows-7 script user-profiles

当我安装 Windows Vista/7 时,我将一些用户文件夹移动到一个新分区(即文档、音乐、图片等)。这不包括移动整个用户目录,只是一些数据文件夹。%AppData% 保留在其默认位置 (%SystemDrive%\Users)。

我已经厌倦了通过更改属性对话框下的位置来手动移动每个文件夹。有谁知道我可以编写脚本以应用于我希望的文件夹的方法吗?

Jac*_*cob 6

我通常将文件夹移动到我的单独分区,然后将它们符号链接回 C:\Users 文件夹。这样做的好处是,往往会在自定义路径上中断的旧版应用程序可以照常访问文件夹。

这段批处理脚本应该可以满足您的需求。请注意,您必须以管理员身份运行它才能进行符号链接工作(未经测试,YMMV):

::Change this to the folder where you want to store your data
set DESTFOLDER="Z:\Path\on\other\partition"

::Switch to the current user's profile folder
::Change this to the folder you want to move from if you are moving another user's data
set SOURCEFOLDER="%USERPROFILE%"
pushd "%SOURCEFOLDER%"
for /d %%d in (Documents Music Pictures Videos) do
(
  ::Move the folder to the new partition
  move "%%d" "%DESTFOLDER%\%%d"
  ::Symlink it back to the original location
  mklink /d "%%d" "%DESTFOLDER%\%%d"
)
Run Code Online (Sandbox Code Playgroud)

这只是我的头顶,但它类似于我用于我的 Ubuntu 安装,我将我的主文件夹的所有子文件夹符号链接到我的 NTFS 数据分区。


out*_*sts 0

Lifehacker的 Adam Pash 的Belvedere可能就是您要找的。

Belvedere 的友好界面可创建高级规则,根据文件的名称、扩展名、大小、创建日期等来移动、复制、删除、重命名或打开文件。