[原创]一键转移桌面-收藏夹-文档
@echo off
::设置标题
title 桌面,收藏夹,文档数据转移程序,Designed By CriD.CN,�te%
::定制程序样式
mode con cols=75 lines=15
color f0
::输入及判断分区的合法性
:check
::partition为分区,如C,D,E,F等;
set partition=
set /p partition=请输入放置文档的分区,例如保存在D盘,直接输入D然后回车:
cls
echo 正在检查你的输入,请等待......
if "%partition%"=="" (
echo 不好意思,你没有输入任何东西
goto check)
for /f %%i in ('mountvol ^|find /i "%partition%:"') do @set tmppf=%%i
if not "%tmppf%"=="%partition%:\" (
echo 不好意思,你输入的%partition%盘不存在,请重新输入
goto check )
if "%partition%:"=="A:" (
echo 不好意思,A盘为软驱盘,请重新输入
goto check)
fsutil fsinfo drivetype %partition%:>type.txt
for /f "tokens=3" %%j in (type.txt) do (
if "%%j"=="CD-ROM" (
echo 不好意思,你输入的%partition%盘为CD-ROM驱动器,请重新输入
goto check))
del type.txt /q
::创建目标文件夹
echo 正在创建目标文件夹......
md "%partition%:\Rubbish\Temporary Internet Files">nul 2>nul
md "%partition%:\Rubbish\Temp">nul 2>nul
md "%partition%:\Rubbish\cookies">nul 2>nul
md "%partition%:\Rubbish\history">nul 2>nul
md "%partition%:\Rubbish\最近文档">nul 2>nul
md "%partition%:\Personal\桌面">nul 2>nul
md "%partition%:\Personal\收藏夹">nul 2>nul
md "%partition%:\Personal\我的文档">nul 2>nul
md "%partition%:\Personal\我的文档\我的音乐">nul 2>nul
md "%partition%:\Personal\我的文档\我的图片">nul 2>nul
md "%partition%:\Personal\我的文档\我的视频">nul 2>nul
md "%partition%:\Personal\我的下载">nul 2>nul
::备份原来的注册表
echo 正在备份你原来的设置,若不满意该程序的设置可以,双击reset.bat恢复原来的设置
reg export "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Shell Folders.reg">nul
reg export "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "User Shell Folders.reg">nul
reg export "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Default Shell Folders.reg">nul
reg export "HKEY_CURRENT_USER\Environment" "Environment.reg">nul
echo @echo off>reset.bat
echo regedit /s "Shell Folders.reg">>reset.bat
echo regedit /s "User Shell Folders.reg">>reset.bat
echo regedit /s "Default Shell Folders.reg">>reset.bat
echo regedit /s "Environment.reg">>reset.bat
echo echo 恢复成功,恢复后的设置将在重启后生效,按任意键将重启电脑>>reset.bat
echo pause^>nul>>reset.bat
echo shutdown -r -f -t 0 >>reset.bat
::备份原来的文件(桌面,文档,收藏夹)到目标文件夹
echo 正在转移文件......
xcopy "%userprofile%\桌面" "%partition%:\Personal\桌面" /s /q /h /y>nul 2>nul
xcopy "%userprofile%\My Documents" "%partition%:\Personal\我的文档"
rd "%partition%:\Personal\我的文档\My Music" /s /q>nul 2>nul
rd "%partition%:\Personal\我的文档\My Pictures" /s /q>nul 2>nul
rd "%partition%:\Personal\我的文档\My Video" /s /q>nul 2>nul
xcopy "%userprofile%\My Documents\My Music" "%partition%:\Personal\我的文档\我的音乐" /s /q /h /y>nul 2>nul
xcopy "%userprofile%\My Documents\My Pictures" "%partition%:\Personal\我的文档\我的图片" /s /q /h /y>nul 2>nul
xcopy "%userprofile%\My Documents\My Video" "%partition%:\Personal\我的文档\我的视频" /s /q /h /y>nul 2>nul
xcopy "%userprofile%\Favorites" "%partition%:\Personal\收藏夹" /s /q /h /y>nul 2>nul
::将信息生成注册表文件,并将其导入
echo 正在生成新的配置信息......
echo
echo. >>set.reg
::[HKEY_CURRENT_USER\So ftware\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
::[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
::[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
echo
echo
echo
echo
::[HKEY_CURRENT_USER\Environment]设置环境变量
echo
echo
echo
echo 正在导入配置信息......
regedit /s set.reg
del set.reg /q
echo 转移成功,设置将在重启之后生效,按任意键重启计算机
pause>nul
shutdown -r -f -t 0