|
[注意]深山红叶启动光盘(WinPE&PE Builder)讨论专帖(违令者必删)
以下是针对大家的意见修改后的内容:
rem 用户重要数据文件夹重定向程序
@echo off
rem 取消对Windows98的支持
ver|find "版本 5" > nul
if "%ERRORLEVEL%"=="1" goto noxp
rem 判断当前用户目录下是否存在文件
dir "%USERPROFILE%\My Documents"|find "0 个文件" >nul
if "%ERRORLEVEL%"=="0" goto newsetup
rem 存在则开始处理,否则询问是否是新装的系统
goto start
:newsetup
cls
color 2f
echo.
echo 默认的当前用户目录没有发现任何文件!
echo 如果已经修改过用户文件夹,请选择 N !
SET Newset=
SET /P Newset= 当前系统是否是新安装、未修改配置的系统(Y/N)?
ECHO.
IF /I ';%Newset%';==';'; GOTO newsetup
IF /I ';%Newset%';==';Y'; GOTO start
IF /I ';%Newset%';==';N'; GOTO nocdisk
:start
cls
color 1f
echo.
echo.
ECHO 用户重要数据文件夹重定向程序
echo.
ECHO 深山红叶制作
echo.
ECHO ========================================================
echo.
echo 本程序可快速将当前用户的系列默认数据文件夹转移到非系统分区,
echo 以便在系统恢复及系统故障时,用户数据不会受到破坏!
echo 您也可以用记事本打开本程序修改默认文件夹路径为您喜欢的路径!
echo.
echo 请输入您想移动的系列用户数据文件夹的目标路径。
echo 其他如收藏夹、我的文档、我的图片、桌面、OE 邮件等,
echo 均将转移到指定的目标文件夹下。
echo.
echo 注意:
echo 1. 如果不输入,则默认目标路径将设置为 D:\我的文档
echo 2. 文件夹路径中的盘符及斜杠必须用半角输入!
echo 3. 如果您的机器有多个用户,请不要使用程序的默认目标路径!
echo.
set Choice=
echo 新的用户数据文件夹路径为(回车则默认为“D:\我的文档”):
set /p Choice=
if "%Choice%" == "" SET Choice=D:\我的文档
rem 检查是否是正确的绝对路径
set Choice|find ":\" > nul
if "%ERRORLEVEL%"=="1" goto err
goto begin
:err
rem 错误路径提示
cls
color 4f
ECHO.
echo 路径格式输入错误!您必须输入完整的绝对路径(比如 D:\我的文档)!
echo 任意键返回……
Pause>nul
goto start
:begin
echo.
echo 正在重新配置用户数据文件夹路径到“%Choice%”,请稍候……
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Cache /d "%Choice%\Temporary Internet Files">nul 2>nul
if exist "%Choice%\Temporary Internet Files" attrib +h "%Choice%\Temporary Internet Files">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Desktop /d "%Choice%\桌面">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Favorites /d "%Choice%\收藏夹">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Personal /d "%Choice%\个人文档">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v "My Music" /d "%Choice%\我的音乐">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v "My Pictures" /d "%Choice%\我的图片">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Recent /d "%Choice%\最近文档">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Cache /d "%Choice%\Temporary Internet Files">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Desktop /d "%Choice%\桌面">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Favorites /d "%Choice%\收藏夹">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Personal /d "%Choice%\个人文档">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v "My Music" /d "%Choice%\我的音乐">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v "My Pictures" /d "%Choice%\我的图片">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Recent /d "%Choice%\最近文档">nul 2>nul
reg add "HKCU\Identities\{F4E98C86-4D9A-463F-920C-1DF555C3B434}\Software\Microsoft\Outlook Express\5.0" /f /v "Store Root" /d "%Choice%\OE 邮件">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Cache /d "%Choice%\Temporary Internet Files">nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /f /v Desktop /d "%Choice%\桌面">nul 2>nul
reg add "HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Desktop /d "%Choice%\桌面">nul 2>nul
reg add "HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v Cache /d "%Choice%\Temporary Internet Files">nul 2>nul
reg add "HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /f /v "Download Directory" /d "%Choice%\下载文件">nul 2>nul
reg add "HKCU\Environment" /f /v TEMP /d "%SystemRoot%\TEMP">nul 2>nul
reg add "HKCU\Environment" /f /v TMP /d "%SystemRoot%\TEMP">nul 2>nul
cls
echo.
echo.
echo 用户系列数据文件夹重定向到“%Choice%”设置完毕!
echo.
echo 是否需要转移现有的用户目录中的文件到“%Choice%”?
echo.
echo Y= 立即自动转移文件到非系统分区的上述指定路径
echo N= 以后手工转移用户文件
echo.
:ASKMOVE
SET Move=
SET /P Move= 请选择要进行的操作(Y/N),然后按回车:
ECHO.
IF /I ';%Move%';==';'; GOTO ASKMOVE
IF /I ';%Move%';==';Y'; GOTO SMOVE
IF /I ';%Move%';==';N'; GOTO OK
:SMOVE
echo 正在开始转移现有用户数据文件到“%Choice%”,请稍候……
if not exist "%Choice%\nul" md "%Choice%">nul 2>nul
if not exist "%Choice%\桌面\nul" md "%Choice%\桌面">nul 2>nul
if not exist "%Choice%\收藏夹\nul" md "%Choice%\收藏夹">nul 2>nul
if not exist "%Choice%\我的图片\nul" md "%Choice%\我的图片">nul 2>nul
if not exist "%Choice%\我的音乐\nul" md "%Choice%\我的音乐">nul 2>nul
move /-Y "%USERPROFILE%\My Documents\*.*" "%Choice%">nul 2>nul
move /-Y "%USERPROFILE%\Desktop\*.*" "%Choice%\桌面">nul 2>nul
move /-Y "%USERPROFILE%\桌面\*.*" "%Choice%\桌面">nul 2>nul
move /-Y "%USERPROFILE%\Favorites\*.*" "%Choice%\收藏夹">nul 2>nul
move /-Y "%USERPROFILE%\My Pictures\*.*" "%Choice%\我的图片">nul 2>nul
move /-Y "%USERPROFILE%\My Music\*.*" "%Choice%\我的音乐">nul 2>nul
:ok
echo.
echo 用户系列数据文件夹重定向设置及数据转移完毕!
echo 您的当前用户关键数据文件夹已经转移到了“%Choice%”!
echo.
echo 请立即重新登录系统后生效!任意键退出!
Pause>nul
goto end
:noxp
echo.
echo 不支持您的系统!任意键退出!
Pause>nul
goto end
:nocdisk
echo.
echo 用户数据文件夹似乎已经在非系统分区,任意键退出!
Pause>nul
goto end
:end
del /Q %TEMP%\Personal.reg >nul 2>nul
exit
|
|