|  | 
 
| 复制代码cls
@echo off
if not "%~n0"=="EncryBat" goto EncryBat_Display
if not "%~n1"=="" if exist "%~f1" copy/b "%~f0"+"%~f1" "%~dp1enc_%~nx1">nul 2>nul&cls&echo.&echo. Enc_%~nx1 is create.&goto :eof
:EncryBat_Help
echo.
echo %~n0 - Cryptographic machine for batch program
echo zxcv@cn-dos, willsort@cn-dos - 2006-8-3 - CMD@WinXP
echo.
echo Useage: %~n0 batch_program_with_extname
echo Reference: http://www.cn-dos.net/forum/viewthread.php?tid=22053  
if /i not [%0]==[EncryBat] pause
goto :eof
:EncryBat_Display
@echo off&setlocal enabledelayedexpansion
color 9f
mode con:cols=55 lines=16
title 个人资料转移批处理版 v1.0  By:MmingHui  
:win
cls
echo.
echo      个人资料转移批处理版 v1.0        By:MmingHui
echo  ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗╔┉┉┉┉┉┉┉╗
echo. ┋                              ┋┋              ┋
echo  ┋    本程序预先搜索是否存在    ┋┋  1.资料转移  ┋
echo. ┋    D盘,如果存在D盘则移动    ┋┋              ┋
echo  ┋    我的文档/收藏夹/桌面/     ┋┋  2.恢复转移  ┋
echo. ┋    Cookies到"D:\我的文档"    ┋┋              ┋
echo  ┋                              ┋┋              ┋
echo. ┋    如果搜索没有D盘,则退     ┋┋              ┋
echo. ┋    出程序!                  ┋┋  Z.退出程序  ┋
echo  ┋                              ┋┋              ┋
echo. ╚┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╝╚┉┉┉┉┉┉┉╝
:cho
set choice=
set /p choice=          请输入对应的按回车:
IF NOT "%Choice%"=="" SET Choice=%Choice:~0,1%
if /i "%choice%"=="1" goto Search
if /i "%choice%"=="2" goto Net
if /i "%choice%"=="Z" goto Exit
echo   输入错误,请重新输入。。。
@ping 127.0.0.1 -n 1 >nul
goto win
pause>nul
:Search
for /f "delims=" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find /i "固定">nul && echo !drive! >>%Temp%\drive.txt
)
for /f %%a in ('findstr /i "d:" %Temp%\drive.txt') do if /i "%%~a"=="d:" goto yes
goto no
:yes
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Favorites" /t REG_SZ /d "D:\我的文档\My Documents\Favorites" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_SZ /d "D:\我的文档\My Documents" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Music" /t REG_SZ /d "D:\我的文档\My Documents\My Music" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Video" /t REG_SZ /d "D:\我的文档\My Documents\My Video" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Pictures" /t REG_SZ /d "D:\我的文档\My Documents\My Pictures" /f >nul
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths" /v "Administrator" /t REG_SZ /d "D:\我的文档\My Documents" /f >nul
xcopy "%userprofile%\My Documents\Favorites" "D:\我的文档\My Documents\Favorites" /i /e /h /y /k >nul
xcopy "%userprofile%\Favorites" "D:\我的文档\My Documents\Favorites" /i /e /h /y /k >nul
xcopy "%userprofile%\My Documents" "D:\我的文档\My Documents" /i /e /h /y /k >nul
taskkill /f /im explorer.exe >nul
start explorer.exe >nul
@ping 127.0.0.1 -n 1 >nul
del /f/s/q %Temp%\drive.txt >nul
del /f/s/q/a "%userprofile%\Favorites\*.*" >nul
for /f "delims=" %%a in ('dir /s/b/ad "%userprofile%\Favorites"') do rd /s/q "%%a" >nul 2>nul
del /f/s/q/a "%userprofile%\My Documents\*.*" >nul
for /f "delims=" %%a in ('dir /s/b/ad "%userprofile%\My Documents"') do rd /s/q "%%a" >nul 2>nul
del /f/s/q/a "%userprofile%\Cookies\*.*" >nul
exit
:no
del /f/s/q %Temp%\drive.txt >nul
exit
:net
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Favorites" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents\Favorites" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Music" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents\My Music" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "My Video" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\My Documents\My Video" /f >nul
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
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths" /v "Administrator" /t REG_SZ /d "%USERPROFILE%\My Documents" /f >nul
xcopy "D:\我的文档\My Documents\Favorites" "%userprofile%\My Documents\Favorites" /i /e /h /y /k >nul
xcopy "D:\我的文档\Favorites" "%userprofile%\My Documents\Favorites" /i /e /h /y /k >nul
xcopy "D:\我的文档\My Documents" "%userprofile%\My Documents" /i /e /h /y /k >nul
taskkill /f /im explorer.exe >nul
start explorer.exe >nul
@ping 127.0.0.1 -n 2 >nul
del /f/s/q/a "D:\我的文档\*.*" >nul
for /f "delims=" %%a in ('dir /s/b/ad "D:\我的文档"') do rd /s/q "%%a" >nul 2>nul
rd /s/q D:\我的文档 >nul
exit
 批处理如上另外附件也是
 
 我想把上面的功能分开一下。
 分成两个批理处。一个是修改我的文档和收藏夹位置的批处理
 另一个是还原我的文档和收藏夹位置的批处理
 
 还请高手帮忙修改一下。。并看看这个不是不会检测硬盘。(批处理的作用。检测是否有D盘,如果有D盘修改这些的位置,如果 没有就不修改了)
 
 谢谢了
 
 
  批处理.rar
(1.5 KB, 下载次数: 44) 
 [ 本帖最后由 94first 于 2011-3-31 18:49 编辑 ]
 | 
 |