无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 5418|回复: 15
打印 上一主题 下一主题

[原创] 收藏了N年的《复制并转移系统资料文件夹向导》

  [复制链接]
跳转到指定楼层
#
发表于 2016-8-15 23:23:15 | 只看该作者 回帖奖励 |正序浏览 |阅读模式


  1. @echo off
  2. title 命令提示符
  3. if "%1"=="/?" goto help
  4. if "%1"=="/h" goto help
  5. if "%1"=="/H" goto help
  6. if "%1"=="/u" goto original
  7. if "%1"=="/U" goto original
  8. :: for /f "tokens=2*" %%a in ('reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v ProductName 2^>nul^|findstr "Microsoft"') do @set V=%%b
  9. :: if "%V%"=="" echo This program cannot be run in DOS mode.
  10. :: goto end
  11. title 复制并转移系统资料文件夹向导
  12. :input
  13. cls
  14. echo 当前系统资料文件夹名称及位置。
  15. echo.
  16. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal ^|findstr "Personal"') do @set MD=%%b
  17. echo 『我的文档』
  18. if "%MD%*"=="*" set MD=%USERPROFILE%\My Documents
  19. echo %MD%
  20. for /f "tokens=3*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Music" ^|findstr "Music"') do @set MM=%%b
  21. echo 『我的音乐』
  22. if "%MM%*"=="*" set MM=%USERPROFILE%\My Documents\My Music
  23. echo %MM%
  24. for /f "tokens=3*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Video" 2^>nul^|findstr "Video"') do @set MV=%%b
  25. echo 『我的视频』
  26. if "%MV%*"=="*" set MV=%USERPROFILE%\My Documents\My Videos
  27. echo %MV%
  28. for /f "tokens=3*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Pictures" ^|findstr "Pictures"') do @set MP=%%b
  29. echo 『图片收藏夹』
  30. if "%MP%*"=="*" set MP=%USERPROFILE%\My Documents\My Pictures
  31. echo %MP%
  32. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Favorites ^|findstr "Favorites"') do @set F=%%b
  33. echo 『收藏夹』
  34. if "%F%*"=="*" set F=%USERPROFILE%\Favorites
  35. echo %F%
  36. :: 传真
  37. :: HKLM\SOFTWARE\Microsoft\Fax
  38. :: HKLM\SOFTWARE\Microsoft\Fax\ActivityLogging
  39. :: DBFile=%ALLUSERSPROFILE%\Application Data\Microsoft\Windows NT\MSFax\ActivityLog
  40. :: HKLM\SOFTWARE\Microsoft\Fax\Inbox
  41. :: Folder=%ALLUSERSPROFILE%\Application Data\Microsoft\Windows NT\MSFax\Inbox
  42. :: HKLM\SOFTWARE\Microsoft\Fax\SentItems
  43. :: Folder=%ALLUSERSPROFILE%\Application Data\Microsoft\Windows NT\MSFax\SentItems
  44. ::
  45. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache ^|findstr "Temporary"') do @set Ca=%%b
  46. echo 『Cache』
  47. if "%Ca%*"=="*" set Ca=%USERPROFILE%\Local Settings\Temporary Internet Files
  48. echo %Ca%
  49. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies ^|findstr "Cookies"') do @set Co=%%b
  50. echo 『Cookies』
  51. if "%Co%*"=="*" set Co=%USERPROFILE%\Cookies
  52. echo %Co%
  53. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History ^|findstr "History"') do @set H=%%b
  54. echo 『History』
  55. if "%H%*"=="*" set H=%USERPROFILE%\Local Settings\History
  56. echo %H%
  57. for /f "tokens=2 delims={}" %%a in ('REG QUERY HKCU\Identities /v "Default User ID" 2^>nul^|findstr /i "Default"') do @set O=%%a
  58. for /f "tokens=3*" %%a in ('REG QUERY "HKCU\Identities\{%O%}\Software\Microsoft\Outlook Express\5.0" /v "Store Root" 2^>nul^|findstr "Store"') do @set OE=%%b
  59. echo 『Outlook Express』
  60. if "%OE%*"=="*" set OE=%USERPROFILE%\Local Settings\Application Data\Identities\{88888888-8888-8888-8888-888888888888}\Microsoft\Outlook Express\
  61. echo %OE%
  62. for /f "tokens=2*" %%a in ('REG QUERY "HKCU\Environment" /v TEMP ^|findstr "TEMP"') do @set T=%%b
  63. echo 『TEMP』
  64. if "%T%*"=="*" set T=%%USERPROFILE%%\Local Settings\Temp
  65. echo %T%
  66. echo.
  67. set /P OK="请输入一个指令或目标驱动器:[H | Q | U | drive:] "
  68. if "%OK%"=="h" set h=1&&goto help
  69. if "%OK%"=="H" set h=1&&goto help
  70. if "%OK%"=="q" echo.&&echo 正在退出. . .&&call :ProcDelay 200&&goto end
  71. if "%OK%"=="Q" echo.&&echo 正在退出. . .&&call :ProcDelay 200&&goto end
  72. if "%OK%"=="u" goto original
  73. if "%OK%"=="U" goto original
  74. if not exist %OK%\nul goto input
  75. if exist "%MD%\nul" xcopy "%MD%\*.*" "%OK%\My Documents" /i /q /h /r /y >nul 2>nul
  76. if exist "%Co%\nul" xcopy "%Co%\*.*" "%OK%\My Documents\Cookies" /s /i /q /h /r /y >nul 2>nul
  77. if exist "%F%\nul" xcopy "%F%\*.url" "%OK%\My Documents\Favorites" /s /i /q /h /r /y >nul 2>nul
  78. if exist "%H%\nul" xcopy "%H%\*.*" "%OK%\My Documents\History" /s /i /q /h /r /y >nul 2>nul
  79. if exist "%MM%\nul" xcopy "%MM%\*.*" "%OK%\My Documents\My Music" /s /i /q /h /r /y >nul 2>nul
  80. if exist "%MP%\nul" xcopy "%MP%\*.*" "%OK%\My Documents\My Pictures" /s /i /q /h /r /y >nul 2>nul
  81. if exist "%MV%\nul" xcopy "%MV%\*.*" "%OK%\My Documents\My Videos" /s /i /q /h /r /y >nul 2>nul
  82. if exist "%OE%\nul" xcopy "%OE%\*.*" "%OK%\My Documents\Outlook Express" /s /i /q /h /r /y >nul 2>nul
  83. if exist "%Ca%\nul" xcopy "%Ca%\*.*" "%OK%\My Documents\Temporary Internet Files" /s /i /q /h /r /y >nul 2>nul
  84. reg delete "HKCU\Identities\{%O%}" /f>nul
  85. reg add "HKCU\Environment" /v "TEMP" /t REG_EXPAND_SZ /d "%OK%\My Documents\Temp" /f>nul
  86. reg add "HKCU\Environment" /v "TMP" /t REG_EXPAND_SZ /d "%OK%\My Documents\Temp" /f>nul
  87. reg add "HKCU\Identities" /v "Default User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  88. reg add "HKCU\Identities" /v "Last User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  89. reg add "HKCU\Identities\{88888888-8888-8888-8888-888888888888}" /v "User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  90. reg add "HKCU\Identities\{88888888-8888-8888-8888-888888888888}\Software\Microsoft\Outlook Express\5.0" /v "Store Root" /t REG_EXPAND_SZ /d "%OK%\My Documents\Outlook Express\" /f>nul
  91. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Cache" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files" /f>nul
  92. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Cookies" /t REG_SZ /d "%OK%\My Documents\Cookies" /f>nul
  93. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Favorites" /t REG_SZ /d "%OK%\My Documents\Favorites" /f>nul
  94. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "History" /t REG_SZ /d "%OK%\My Documents\History" /f>nul
  95. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Music" /t REG_SZ /d "%OK%\My Documents\My Music" /f>nul
  96. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Pictures" /t REG_SZ /d "%OK%\My Documents\My Pictures" /f>nul
  97. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Video" /t REG_SZ /d "%OK%\My Documents\My Videos" /f>nul
  98. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" /t REG_SZ /d "%OK%\My Documents" /f>nul
  99. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cache" /t REG_EXPAND_SZ /d "%OK%\My Documents\Temporary Internet Files" /f>nul
  100. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cookies" /t REG_EXPAND_SZ /d "%OK%\My Documents\Cookies" /f>nul
  101. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Favorites" /t REG_EXPAND_SZ /d "%OK%\My Documents\Favorites" /f>nul
  102. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "History" /t REG_EXPAND_SZ /d "%OK%\My Documents\History" /f>nul
  103. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_EXPAND_SZ /d "%OK%\My Documents\My Pictures" /f>nul
  104. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "%OK%\My Documents" /f>nul
  105. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths" /v "Directory" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files\Content.IE5" /f>nul
  106. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path1" /v "CachePath" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files\Content.IE5\Cache1" /f>nul
  107. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path2" /v "CachePath" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files\Content.IE5\Cache2" /f>nul
  108. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path3" /v "CachePath" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files\Content.IE5\Cache3" /f>nul
  109. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path4" /v "CachePath" /t REG_SZ /d "%OK%\My Documents\Temporary Internet Files\Content.IE5\Cache4" /f>nul
  110. echo.
  111. echo 文件夹内容已经复制;注册表信息已经更改,重新启动后生效!
  112. call :ProcDelay 400
  113. goto end
  114. :original
  115. reg add "HKCU\Environment" /v "TEMP" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Local Settings\Temp" /f>nul
  116. reg add "HKCU\Environment" /v "TMP" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Local Settings\Temp" /f>nul
  117. reg add "HKCU\Identities" /v "Default User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  118. reg add "HKCU\Identities" /v "Last User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  119. reg add "HKCU\Identities\{88888888-8888-8888-8888-888888888888}" /v "User ID" /t REG_SZ /d "{88888888-8888-8888-8888-888888888888}" /f>nul
  120. reg add "HKCU\Identities\{88888888-8888-8888-8888-888888888888}\Software\Microsoft\Outlook Express\5.0" /v "Store Root" /t REG_EXPAND_SZ /d "%USERPROFILE%\Local Settings\Application Data\Identities\{88888888-8888-8888-8888-888888888888}\Microsoft\Outlook Express\" /f>nul
  121. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Cache" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files" /f>nul
  122. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Cookies" /t REG_SZ /d "%USERPROFILE%\Cookies" /f>nul
  123. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Favorites" /t REG_SZ /d "%USERPROFILE%\Favorites" /f>nul
  124. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "History" /t REG_SZ /d "%USERPROFILE%\Local Settings\History" /f>nul
  125. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Music" /t REG_SZ /d "%USERPROFILE%\My Documents\My Music" /f>nul
  126. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Pictures" /t REG_SZ /d "%USERPROFILE%\My Documents\My Pictures" /f>nul
  127. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "My Video" /t REG_SZ /d "%USERPROFILE%\My Documents\My Videos" /f>nul
  128. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" /t REG_SZ /d "%USERPROFILE%\My Documents" /f>nul
  129. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cache" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Local Settings\Temporary Internet Files" /f>nul
  130. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Cookies" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Cookies" /f>nul
  131. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Favorites" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Favorites" /f>nul
  132. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "History" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Local Settings\History" /f>nul
  133. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents\My Pictures" /f>nul
  134. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents" /f>nul
  135. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths" /v "Directory" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5" /f>nul
  136. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path1" /v "CachePath" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5\Cache1" /f>nul
  137. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path2" /v "CachePath" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5\Cache2" /f>nul
  138. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path3" /v "CachePath" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5\Cache3" /f>nul
  139. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Paths\path4" /v "CachePath" /t REG_SZ /d "%USERPROFILE%\Local Settings\Temporary Internet Files\Content.IE5\Cache4" /f>nul
  140. echo.
  141. echo 注册表信息已经恢复,重新启动后生效!
  142. call :ProcDelay 400
  143. goto end
  144. :help
  145. if "%h%"=="1" echo.
  146. echo 复制并转移系统资料文件夹。
  147. echo.
  148. echo DATAMOVE [drive:] [/U] [/Q] [/H]
  149. echo.
  150. echo   drive:  指定您想转移到的目标驱动器
  151. echo   /U      恢复系统默认值
  152. echo   /Q      向导中退出
  153. echo   /H      显示帮助信息
  154. echo.
  155. echo 不加任何参数键入 DATAMOVE,可以启动一个向导。
  156. echo.
  157. echo 目标驱动器将自动添加文件夹路径 My Documents。
  158. echo.
  159. echo 命令行开关 /U 会将更改过的系统注册表信息还原。
  160. echo 它不会还原回您之前已更改系统的任何值,而直接
  161. echo 还原回系统的默认值。
  162. echo.
  163. if "%h%"=="1" pause&&set h=&&goto input
  164. goto end

  165. :ProcDelay number
  166. Setlocal EnableExtensions
  167. for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set start_=%%h%%i%%j%%k
  168.      :wait_
  169.      for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set now_=%%h%%i%%j%%k
  170.      set /a diff_=%now_%-%start_%
  171. if %diff_% lss %1 goto wait_
  172. Endlocal

  173. :end
  174. set MD=
  175. set MM=
  176. set MV=
  177. set MP=
  178. set F=
  179. set Ca=
  180. set Co=
  181. set H=
  182. set O=
  183. set OE=
  184. set T=
  185. set OK=
复制代码

15#
发表于 2024-2-24 13:15:54 | 只看该作者
谢谢楼主分享
回复

使用道具 举报

14#
发表于 2024-2-23 23:18:06 | 只看该作者
批处理方便,值得学习
回复

使用道具 举报

13#
发表于 2024-2-23 12:10:45 | 只看该作者
谢谢分享
回复

使用道具 举报

12#
发表于 2024-2-22 21:10:11 | 只看该作者
看看思路
回复

使用道具 举报

11#
发表于 2023-11-13 11:45:29 | 只看该作者
谢谢分享
回复

使用道具 举报

10#
发表于 2017-1-9 20:52:43 来自手机 | 只看该作者
好东东,学习了…
回复

使用道具 举报

9#
发表于 2017-1-9 20:51:51 来自手机 | 只看该作者
好东东,学习了…
回复

使用道具 举报

8#
发表于 2017-1-9 20:50:54 来自手机 | 只看该作者
好东东,学习了…
回复

使用道具 举报

7#
发表于 2016-11-2 01:48:58 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

6#
发表于 2016-10-22 01:02:12 | 只看该作者
学习了~~~
回复

使用道具 举报

5#
发表于 2016-10-9 09:33:10 | 只看该作者
两个批处理,内容很充实啊,学习了
回复

使用道具 举报

4#
发表于 2016-10-2 20:38:36 | 只看该作者
好东西,方便。
回复

使用道具 举报

3#
发表于 2016-8-21 14:47:08 来自手机 | 只看该作者
z感谢分享,不用手动了
回复

使用道具 举报

2#
发表于 2016-8-16 03:50:00 | 只看该作者
不知道,在XP下和windows 7 下面一样不???
回复

使用道具 举报

1#
发表于 2016-8-16 01:32:45 | 只看该作者
额,我向来都是手动移的,重装系统后则是用批处理改一下注册表
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-29 05:14

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表