バッチ処理でファイルバックアップを実現するV 2.3
52447 ワード
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: V2.3(for WinXP only) Code by JM 2006-11-4 QQ:13132002
:: :http://www.cn-dos.net/forum/viewthread.php?tid=20747
::
:: :1、 ( )、 、
:: 2、
:: 3、
:: 4、
:: 5、
:: 6、
:: 7、 ,
::
:: :
::
:: :
::
:: ① ;
:: ②
::
:: :
::
:: 06.11.4
::
:: , ;
::
:: 06.10.19
::
:: at , ;
:: xcopy /c , ( ),
:: ; ;
::
:: 06.9.14
::
:: , ,
:: pengfei ; ;
:: ; V2.3
::
:: 06.9.3
::
:: , , ,
:: pengfei ; ;
::
:: 06.8.5
::
:: , ;
:: 06.8.1
::
:: ; ;
:: 06.7.29
::
:: , willsort ;
:: 06.7.28
:: ,
:: ; V2.2
::
:: 06.7.1
:: ;
:: 06.6.29
:: ; ; V2.1;
:: 06.6.20
:: , ,
:: ;
:: 06.6.15
:: ( bagpipe );
:: 06.6.12
:: , 。
:: willsort ; ,
:: , ; ;
:: ;
:: 06.6.10
:: ; ;
:: 06.6.9
:: , ;
:: ( electronixtar ),
:: ( http://www.cn-dos.net/forum/viewthread.php?
:: tid=21091&fpage=1);
:: 06.6.6
:: , , ;
:: ( willsort ); V1.9;
:: 06.6.4
:: : ,
:: , ; ;
:: 06.6.3
:: ,
:: , ,
:: willsort ; ,
:: ;
:: 06.6.2
:: : ;
:: ,
:: , , ;
:: ; ;
:: ( willsort ); ; , V1.8;
:: 06.5.31
:: ( :HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\
:: CurrentVersion\Run) (
:: ) , ; ,
:: ; ; V1.7;
:: 06.5.30
:: , , ;
:: , , ;
:: , ;
:: , ;
:: 06.5.28
:: ;
:: ; , ;
:: ; ; V1.6 ;
:: 06.5.26
:: 、
:: ; ; ; DOS
:: (http://www.cn-dos.net/forum) bagpipe ,
:: ; V1.5;
:: 06.5.25
:: ;
:: ; ; ; V1.4;
:: 06.5.24
:: ; DOS
:: (http://www.cn-dos.net/forum) willsort ; V1.3;
:: 06.5.23
:: , ; DOS
:: (http://www.cn-dos.net/forum) willsort ,
:: , , ;
:: 06.5.22
:: ,
:: ;
:: 06.5.21
:: , ;
:: " + " ,
:: ; ; ; V1.2;
:: 06.5.20
:: , copy xcopy ,
:: (
:: 、 ) , ;
:: , ,
:: , ,
:: ; ; V1.1;
:: 06.5.19
:: , XP ;
:: , ; , ;
:: , ,
:: , ; ;
:: 06.5.18
:: , ,
:: , DOS ,
:: , ; V1.0;
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
rem if not "%1"=="$" %comspec% /f:on /c %0 $ && goto :eof
:: , Tab\Shift+Tab
mode con lines=26
title -
color 1f
cls
rem ========= =============
:check_system
ver|find "XP">nul || goto system_error
rem ========= =============
:check_popedom
net users %username%|findstr /i "\*administrator">nul||goto popedom_error
call :del_nouse
rem ======= =======
:input_source
mode con lines=26
cls
color 1f
title -
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ 。 ( ) ( │
echo │ │
echo │ ), │
echo │ │
echo │ ( ), 。 │
echo │ │
echo │ Tab\Shift+Tab, 。 │
echo │ │
echo │ , │
echo │ │
echo │ ! ! ( R ) │
echo │ │
echo t────────────────────────────s
echo.
echo 1 0
echo ──────────────────────────────
echo 2
echo.
set source=:
set /p source= :
set "source=%source:"=%"
:: %source% , 。
if "%source%"==":" goto input_source
if "%source%"=="0" exit
if "%source%"=="1" goto notice
if "%source%"=="2" goto backup_task
if /i "%source%"=="r" goto revert
if not exist "%source%" goto source_noexist
for %%i in ("%source%") do if "%%~fi"=="%%~di\" goto forbid_to_backup
:: ,
pushd "%source%">nul 2>nul && (popd & set folder=yes)||(set folder=)
goto input_destination
:backup_task
cls
color 1f
title -
echo.
at
echo -------------------------------------------------------------------------------
echo.
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U , ID , U
echo U U
echo U ID , A U
echo U U
echo U 0 , 0、A ID U
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
set ID=
set /p ID= ID:
if "%ID%"=="0" exit
if /i "%ID%"=="a" at /delete /yes && (call :del_nouse && goto backup_task)
:: : , bat ,
:: at ; , bat, ;
:: , ;
(for %%i in (%ID%) do at %%i /del /yes >nul 2>nul) && (
call :del_nouse
goto backup_task
) || goto input_source
rem ======= =======
:input_destination
cls
color 1f
title -
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ : │
echo │ │
echo │ │
echo │ │
echo │ ( : ; │
echo │ │
echo │ ), │
echo │ │
echo │ , 。 │
echo │ │
echo │ q────────────────r │
echo t─────┤ 9 ├─────s
echo t────────────────s
echo.
echo 1 0
echo ──────────────────────────────
echo.
set destination=:
set /p destination= :
set "destination=%destination:"=%"
:: %destination% ,
if "%destination%"==":" goto input_destination
if "%destination%"=="0" exit
if "%destination%"=="1" goto input_source
if "%destination%"=="9" goto freesize
::
for /d %%i in ("%source%.*") do set destination=%destination%\%%~nxi
for %%i in ("%destination%") do set destination=%%~fi
set subarea=%destination:~0,1%
for %%i in ("%destination%") do if "%%~fi"=="%%~di\" goto forbid_to_build_1
echo "%destination%" | findstr /i /c:"%source%" && goto forbid_to_build_2
if not exist %subarea%:
ul goto subarea_noexist
:: ( )
for %%i in ("%source%") do set name_log=%%~ni
if exist "%destination%\%name_log%_log.log" goto whether_add
if exist "%destination%" goto whether_over
:over_write
attrib /s /d -s -h -r "%destination%\*.*">nul 2>nul
rd /q /s "%destination%">nul 2>nul
md "%destination%">nul 2>nul
(echo.
echo )>"%destination%\%name_log%_log.log"
attrib /s /d +s +r "%destination%\*.*">nul 2>nul
:input_date
cls
color 1f
title -
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ 1. , 1 31 │
echo │ │
echo │ , 1,3,4; 1 , "1,"; │
echo │ │
echo │ 2. , │
echo │ │
echo │ (M,T,W,Th,F,S,Su); , │
echo │ │
echo │ , ; │
echo │ │
echo │ 3. ; │
echo │ │
echo │ , ; ! │
echo │ │
echo t────────────────────────────s
echo.
echo 1 0
echo ──────────────────────────────
echo A
echo.
set copydate=
set /p copydate= :
if "%copydate%"=="" goto input_date
if "%copydate%"=="," goto input_date
if "%copydate%"=="0" exit
if "%copydate%"=="1" goto input_destination
if "%copydate%"=="1," goto input_time
if /i "%copydate%"=="a" goto all_date
::
set num=0
set char=%copydate%
for /f "tokens=1 delims=," %%i in ("%char%") do (
echo "%%i"|findstr /i "M T W Th F S Su">nul && goto check_alphabetical_date|| goto check_numerical_date
)
:check_alphabetical_date
call :check_alp
:loop_alp
set char=%char:*,=%
:check_alp
for /f "tokens=1 delims=," %%i in ("%char%") do (
echo "M T W Th F S Su"|findstr /i "%%i">nul || goto date_error
echo "%char%"|find ",">nul && goto loop_alp
)
goto input_time
:check_numerical_date
call :check_num
:loop_num
set /a num+=1
set char=%char:*,=%
:check_num
for /f "tokens=1 delims=," %%i in ("%char%") do set input=%%i
if %input% GTR 31 goto date_error
if %num% GTR 30 goto date_error
echo %char%|find ",">nul || if %num% LEQ 30 goto input_time || goto date_error
goto loop_num
:input_time
cls
color 1f
title -
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ : │
echo │ │
echo │ , │
echo │ │
echo │ 。 24 ( 00:00 23:59) │
echo │ │
echo │ : 。 │
echo │ │
echo │ : 8 30 4 │
echo │ │
echo │ , 8:30 16:00( : │
echo │ │
echo │ ) │
echo │ │
echo t────────────────────────────s
echo.
echo 1 0
echo ──────────────────────────────
echo.
set copytime=
set /p copytime= :
if "%copytime%"=="" goto input_time
if "%copytime%"=="0" exit
if "%copytime%"=="1" goto input_date
::
for /f "tokens=*" %%i in ("%copytime%") do set char=%%i
call :check_time
set num=0
:back
set /a num+=1
set char=%char:* =%
:check_time
for /f "tokens=1,2 delims=:" %%i in ("%char%") do (
if %%i GTR 24 goto time_error
if %%j GTR 60 goto time_error
echo %char%|find " ">nul || goto input_name
)
goto back
rem ======= =======
:input_name
cls
color 1f
title -
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ : │
echo │ │
echo │ , 。 │
echo │ │
echo │ " :\Program Files\ │
echo │ │
echo │ " " _backup.bat" │
echo │ │
echo │ " _revert.bat" │
echo │ │
echo │ 。 , │
echo │ │
echo │ 。 │
echo │ │
echo t────────────────────────────s
echo.
echo 1 0
echo ──────────────────────────────
echo.
echo.
set name=
set /p name= :
if "%name%"=="" goto input_name
if "%name%"=="0" exit
if "%name%"=="1" goto input_time
if exist "%ProgramFiles%\ \%name%_backup.bat" goto name_exist
call :list
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U 0 , 1 , B U
echo U U
echo U 0、1 B U
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
set choice=
set /p choice= (0/1/B/ ):
if "%choice%"=="0" exit
if "%choice%"=="1" goto input_name
if /i "%choice%"=="b" (
attrib /s /d -s -h -r "%destination%\*.*">nul 2>nul
rd /q /s "%destination%">nul 2>nul
goto input_source
)
goto build_backup
:notice
cls
mode con lines=40
color 8e
title -
echo.
echo.
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U U
echo U 1. , U
echo U U
echo U , , U
echo U U
echo U 。 , ! U
echo U U
echo U 2. , , U
echo U U
echo U 11 , :\、/、:、*、?、 U
echo U U
echo U "、<、>、(、)、|。 , U
echo U U
echo U ; , ! U
echo U U
echo U 3. " + " , U
echo U U
echo U , 。 : U
echo U U
echo U C , C: , C , C U
echo U U
echo U , "C:\ducuments and settings\ "; U
echo U U
echo U 4. , ; U
echo U U
echo U 5. : U
echo U U
echo U , , U
echo U U
echo U , U
echo U U
echo U 、 ! U
echo U U
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
echo ...
pause>nul
goto input_source
:whether_over
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo ________________________________________________________________________________
echo.
echo "%destination%" , ?
echo.
echo ________________________________________________________________________________
echo.
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U O , A , V , 1 , 0 U
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
echo.
set choice=
set /p choice= (O/A/V/0/1):
if /i "%choice%"=="o" cls && goto over_write
if /i "%choice%"=="a" goto input_date
if /i "%choice%"=="v" call :view_directory && goto whether_over
if "%choice%"=="0" exit
if "%choice%"=="1" goto input_destination
goto whether_over
:whether_add
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo ________________________________________________________________________________
echo.
echo "%destination%" , ?
echo.
echo ________________________________________________________________________________
echo.
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U V , O , A , 1 , 0 U
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
echo.
set choice=
set /p choice= (V/O/A/0/1):
if /i "%choice%"=="o" goto over_write
if /i "%choice%"=="a" cls && goto input_date
if /i "%choice%"=="v" call :view_directory && goto whether_add
if "%choice%"=="0" exit
if "%choice%"=="1" goto input_destination
goto whether_add
:freesize
:: freesize 0~7( 999G, M 7 ),
:: freesize 7 , 7 ,
:: freesize。 , volume 0~20( 32 ,
:: , 20 )。
cls
color 2e
title -
setlocal EnableDelayedExpansion
echo.
echo.
echo XTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT[
echo U (MB) U
echo U _____________________________________________________ U
for %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist %%d:
ul (
for /f "tokens=3" %%z in ('dir /-c %%d:\') do set freesize=%%z
if not "!freesize!"=="0" (
set /a freesize=!freesize:~0,-3!/1049>nul
set freesize= !freesize!
set freesize=!freesize:~-7!
for /f "tokens=3*" %%v in ('vol %%d:') do set volume=%%w
set volume= !volume!
set volume=!volume:~-20!
echo U %%d: !volume! !freesize! U
)
)
)
echo ^TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTa
echo.
echo.
echo.
echo.
echo ...
pause>nul
goto input_destination
rem ======== , =============
:build_backup
call :list
title - ...
if not exist "%ProgramFiles%\ " md "%ProgramFiles%\ "
set batch_directory=%ProgramFiles%\
attrib /s /d -r -h -s "%batch_directory%\*.*">nul 2>nul
:: >"%batch_directory%\%name%_backup.bat" ,
:: ^
(
echo @echo off
echo mode con cols=35 lines=10
echo color 1f
echo title -%name%_backup
echo.
echo rem
echo.
echo rem " V2.3" Code by JM 2006-10-19 QQ:13132002
echo.
echo rem build on %date% %time:~0,-3% by %username%
echo.
echo rem : , ,
echo rem ; , 。
echo.
echo if not exist "%source%" ^(
echo title
echo color 0c
echo echo.
echo echo ___________________________________
echo echo.
echo echo "%source%"
echo echo.
echo ecoh , 、
echo echo.
echo echo ___________________________________
echo ping 127.1 -n 5 ^>nul
echo exit^)
echo if not exist "%destination%" md "%destination%"
)>"%batch_directory%\%name%_backup.bat"
set xcopy_parameter=
if "%folder%"=="yes" (set xcopy_parameter=/e /s) else (goto file_backup)
(
echo attrib /s /d -s -h -r "%destination%\*.*"^>nul 2^>nul
echo set times=
echo setlocal enabledelayedexpansion
echo for /f "delims=" %%%%i in ^('xcopy /c /d /h /i /g /r %xcopy_parameter% /x /y "%source%" "%destination%"'^) do ^(
echo if "%%%%i"==" 0 " ^(exit^) else ^(
echo if not defined times call :head
echo if ^^!file_time^^! lss %%%%~ti set file_time=%%%%~ti^&set file_route=%%%%~dpnxi
echo if not "%%%%~ti"=="" ^(echo %%%%~dpnxi %%%%~ti^>^>"%destination%\%name_log%_log.log"
echo ^) else ^(echo.^&echo %%%%i^)^>^>"%destination%\%name_log%_log.log"
echo ^)
echo if "%%%%i"==" 1 " goto end
echo ^)
echo ^(
echo echo.
echo echo :%%file_route%% , %%file_time%% 。
echo ^)^>^>"%destination%\%name_log%_log.log"
echo :end
echo attrib /s /d +s +r "%destination%\*.*"^>nul 2^>nul
echo start "" "%destination%\%name_log%_log.log"
echo goto :eof
echo.
)>>"%batch_directory%\%name%_backup.bat"
call :build_head
goto build_revert
:file_backup
(
echo xcopy /c /d /h /i /g /q /x /y "%source%" "%destination%"^|findstr /b /e /c:" 0 "^>nul^&^&goto :eof
echo attrib -s -h -r "%destination%\*.*"^>nul 2^>nul
echo echo.^>^>"%destination%\%name_log%_log.log"
echo for /f "skip=1 tokens=1,2" %%%%i in ^('dir /a-d /tw "%source%"^^^|find "-"'^) do ^(
echo echo ^^^<%%date:~0,10%% %%time:~0,8%% ^^^> :%%%%i %%%%j^>^>"%destination%\%name_log%_log.log"
echo ^)
echo attrib +s +r "%destination%\*.*"^>nul 2^>nul
echo start "" "%destination%\%name_log%_log.log"
)>>"%batch_directory%\%name%_backup.bat"
rem ======== ========
:build_revert
:: ( )
for %%i in ("%source%") do set SourceFileName=%%~nxi
:: %source%
if "%folder%"=="yes" (set SourceFiles=%destination%) else (set SourceFiles=%destination%\%SourceFileName%)
(
echo @echo off
echo mode con lines=25
echo color 1f
echo title -%name%_revert
echo.
echo rem
echo.
echo rem " V2.3" Code by JM 2006-10-19 QQ:13132002
echo.
echo rem build on %date% %time:~0,-3% by %username%
echo.
echo rem : , 。 ,
echo rem , ,
echo rem 。
echo if not exist "%destination%" ^(
echo title
echo color 0c
echo echo.
echo echo.
echo echo.
echo echo.
echo echo.
echo echo.
echo echo ________________________________________________________________________________
echo echo.
echo echo "%destination%" , 、
echo echo.
echo echo ________________________________________________________________________________
echo ping 127.1 -n 5 ^>nul
echo exit^)
echo echo.
echo echo.
echo echo.
echo echo.
echo echo.
echo echo.
echo echo ________________________________________________________________________________
echo echo.
echo echo "%destination%" "%source%", ...
echo echo.
echo echo ________________________________________________________________________________
)>"%batch_directory%\%name%_revert.bat"
if "%folder%"=="yes" echo if not exist "%source%" md "%source%">>"%batch_directory%\%name%_revert.bat"
echo attrib /s /d -h -r -s "%source%"^> nul 2^>nul>>"%batch_directory%\%name%_revert.bat"
if "%folder%"=="yes" (goto folder_copy) else (goto file_copy)
:file_copy
for /f "tokens=*" %%i in ("%source%") do (set file_root=%%~dpi)
(
echo xcopy /c /h /q /r %xcopy_parameter% /x /y "%SourceFiles%" "%file_root%"^>nul 2^>nul
echo attrib -h -r -s "%source%"^>nul 2^>nul
)>>"%batch_directory%\%name%_revert.bat"
goto get_attrib
:folder_copy
(
echo xcopy /c /e /h /i /g /q /r /s /x /y "%SourceFiles%" "%source%"^>nul 2^>nul
echo del /a /f "%source%\%name_log%_log.log"^>nul 2^>nul
)>>"%batch_directory%\%name%_revert.bat"
rem ======== ( ) =============
:get_attrib
:: ( ) dir /s , %suorce%
:: %source% ,dir /a /b "%source%"
if "%folder%"=="yes" (set dir_='dir /a /b /s "%source%"') else (set dir_="%source%")
setlocal enabledelayedexpansion
for /f "tokens=*" %%i in (%dir_%) do (
set var=%%~ai
set attrib_=
if not "!var:~1,1!"=="-" set attrib_=+!var:~1,1!
if not "!var:~3,1!"=="-" set attrib_=!attrib_! +!var:~3,1!
if not "!var:~4,1!"=="-" set attrib_=!attrib_! +!var:~4,1!
if not "!attrib_!"=="" echo attrib !attrib_! "%%i">>"%batch_directory%\%name%_revert.bat"
)
:add_to_reg
cls
color 1f
title -
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ : │
echo │ │
echo │ │
echo │ │
echo │ 。 , " │
echo │ │
echo │ \ " "msconfig", " │
echo │ │
echo │ ", " " │
echo │ │
echo │ , [HKEY_LOCAL_MACHINE\ │
echo │ │
echo │ SOFTWARE\Microsoft\Windows\CurrentVersion\ │
echo │ │
echo │ Run] 。 │
echo │ │
echo t────────────────────────────s
echo.
echo S
echo ──────────────────────────────
echo.
set choice=
set /p choice= (S/ ):
if /i "%choice%"=="s" goto run_at
rem ======== =============
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v %name% /t REG_SZ /d "%batch_directory%\%name%_backup.bat" /f >nul 2>nul
:run_at
::
sc config Schedule start= AUTO >nul 2>nul
sc start Schedule>nul 2>nul
rem ========== at =========
for %%i in (%copytime%) do (
at %%i /every:%copydate% "%batch_directory%\%name%_backup.bat">nul 2>nul
)
attrib /s /d -s -r "%destination%\*.*">nul 2>nul
(
echo.
echo ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
echo.
echo %date% %time:~0,8%
echo :%source%
echo :%destination%
echo :%batch_directory%\%name%_backup.bat
echo :%batch_directory%\%name%_revert.bat
echo.
echo ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
echo.
echo ________________________________________________________________________________
)>>"%destination%\%name_log%_log.log"
cls
color 1f
title - ……
echo.
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ : │
echo │ │
echo │ 、 , │
echo │ │
echo │ …… │
echo │ │
echo t────────────────────────────s
xcopy /c /h /i /g /q /r %xcopy_parameter% /x /y "%source%" "%destination%">nul 2>nul
attrib /s /d +s +r "%destination%\*.*">nul 2>nul
::
:: --------------------------------------------------------------------
:: , ,
:: , 。
:: 。
:: , SchedulingAgent NotifyOnTaskMiss
:: --------------------------------------------------------------------
:: reg add HKLM\SOFTWARE\Microsoft\SchedulingAgent /v NotifyOnTaskMiss /t REG_DWORD /d 00000001 /f >nul 2>nul
cls
title
echo.
echo.
type "%destination%\%name_log%_log.log"
echo.
echo.
echo.
echo ...
pause>nul
cls
title
echo.
echo.
echo.
echo.
echo.
echo.
echo ________________________________________________________________________________
echo.
for %%i in (%copytime%) do (
echo ^( ^) %copydate% %%i "%source%"
)
echo.
echo ________________________________________________________________________________
echo.
echo , B , ...
echo.
echo.
set again=
set /p again= :
if /i "%again%"=="b" goto input_source
exit
rem ======== =============
:del_nouse
:: : , bat ,
:: at ; , bat, ;
:: , ;
:: %ProgramFiles% ,
attrib -h -r -s "%ProgramFiles%\ \*.bat">nul 2>nul
setlocal enabledelayedexpansion
for %%i in ("%ProgramFiles%\ \*_backup.bat") do (
set full_name=%%i
set part_name=!full_name:~0,-11!
at|find /i "%%i">nul || find /i "Code by JM" "!part_name!*.bat">nul && (
del /f /q "!part_name!*.bat"
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v %%~fi /f >nul 2>nul
)
)
for %%i in ("%ProgramFiles%\ \*.bat") do (
find /i "Code by JM" "%%i">nul && attrib +r "%%i"
)
if not exist "%ProgramFiles%\ " goto :eof
dir /a /b "%ProgramFiles%\ "|findstr .>nul || rd /q "%ProgramFiles%\ "
goto :eof
:: ━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━
:system_error
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ , XP │
echo │ │
echo │ ... │
echo │ │
echo t────────────────────────────s
ping 127.1 -n 4 >nul && goto :eof
:popedom_error
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ , , │
echo │ │
echo │ │
echo │ │
echo │ ... │
echo │ │
echo t────────────────────────────s
pause>nul
goto :eof
:subarea_noexist
cls
color 0c
title - "%subarea%"
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ %subarea% │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_destination
:source_noexist
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_source
:forbid_to_backup
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_source
:forbid_to_build_1
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ , │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_destination
:forbid_to_build_2
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ : │
echo │ │
echo │ │
echo │ │
echo │ , │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_destination
:destination_input_erro
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_destination
:date_error
cls
color 0c
title -
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ 1. ; │
echo │ │
echo │ 2. 31, │
echo │ │
echo │ 31 ; │
echo │ │
echo │ 3. M,T,W,Th,F,S,Su │
echo │ │
echo │ , ; │
echo │ │
echo │ 4. 。 │
echo │ │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
pause>nul
goto input_date
:time_error
cls
color 0c
title -
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ │
echo │ │
echo │ 24, 60, │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_time
:name_exist
cls
color 0c
title - %name%_backup.bat
echo.
echo.
echo.
echo.
echo.
echo q────────r
echo q─────────┤ ├─────────r
echo │ t────────s │
echo │ │
echo │ │
echo │ "%ProgramFiles%\ " │
echo │ │
echo │ │
echo │ │
echo t────────────────────────────s
echo.
pause>nul
goto input_name
:: ━━━━━━━━━━━━━━━━━ ━━━━━━━━━━━━━━━━━
rem ======== / / ========
:view_directory
explorer "%destination%"
goto :eof
rem ======== ========
:all_date
set copydate=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
goto input_time
goto :eof
rem ======== ========
:revert
explorer "%ProgramFiles%\ "
goto input_source
goto :eof
rem ======== ========
:list
cls
color 1f
title -
echo.
echo ________________________________________________________________________________
echo.
echo :"%name%"
echo.
echo :"%source%"
echo.
echo :"%destination%"
echo.
echo : %copydate%
echo.
echo :%copytime%
echo.
echo ________________________________________________________________________________
echo.
goto :eof
rem ======== ========
:build_head
(
echo :head
echo set times=1
echo ^(
echo echo _____________________________________________________________________________________
echo echo.
echo echo * ^^^(%%date:~0,10%% %%time:~0,8%%^^^):
echo echo.
echo ^)^>^>"%destination%\%name_log%_log.log"
echo goto :eof
)>>"%batch_directory%\%name%_backup.bat"
goto :eof