rem ================================
rem - Автор Nuker Kalidratorma -
rem - Специально для The Huckster -
rem ================================
rem В файле необходимо исправить
rem некоторые пути к директориям,
rem например "m_eve_tranquility"
rem и "M:\eve"!
rem ================================
setlocal
rem Здесь после "tab=" идет табуляция (символ 0x09), а не пустое место!
set tab=
set dt=%date%
set tm=%time%
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%j in (`reg query "HKCU\Control Panel\International" /v sDate`) do set sDate=%%j
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%i in (`reg query "HKCU\Control Panel\International" /v sShortDate`) do set sShortDate=%%i
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%j in (`reg query "HKCU\Control Panel\International" /v iDate`) do set iDate=%%j
call :sub2 %dt%
set year0=%year%
set month0=%month%
set day0=%day%
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%j in (`reg query "HKCU\Control Panel\International" /v sTime`) do set sTime=%%j
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%i in (`reg query "HKCU\Control Panel\International" /v sTimeFormat`) do set sTimeFormat=%%i
for /F "usebackq skip=4 tokens=3 delims=%tab%" %%j in (`reg query "HKCU\Control Panel\International" /v iTime`) do set iTime=%%j
call :sub3 %tm%
set Hour0=%Hour%
set Minute0=%Minute%
set Second0=%Second%
set /A dts=(%year0%-2000)*365+(1%month0%-100)*30+(1%day0%-100)
if not exist "%USERPROFILE%\Local Settings\Application Data\CCP\EVE\m_eve_tranquility\backup" (
md "%USERPROFILE%\Local Settings\Application Data\CCP\EVE\m_eve_tranquility\backup"
)
rem Создаем бэкап перед запуском Евы
"%ProgramFiles%\WinRAR\rar.exe" a -r -m5 -k -rr "%USERPROFILE%\Local Settings\Application Data\CCP\EVE\m_eve_tranquility\backup\settings%year0%%month0%%day0%%Hour0%%Minute0%%Second0%.rar" "%USERPROFILE%\Local Settings\Application Data\CCP\EVE\m_eve_tranquility\settings"
rem Проверяем актуальность бэкапов
for /R "%USERPROFILE%\Local Settings\Application Data\CCP\EVE\m_eve_tranquility\backup" %%j in (*.rar) do (call :sub %%~tj %%~fj)
endlocal
rem Запускаем Еву
rem ЗДЕСЬ ОБЯЗАТЕЛЬНО НАДО СМЕНИТЬ ПУТЬ К ИСПОЛНЯЕМОМУ ФАЙЛУ Евы!!!
start "M:\eve\eve.exe"
exit
rem Подпрограмма проверки актуальности и удаления устаревших версий
:sub
set fdt=%~1
call :sub2 %fdt%
set year1=%year%
set month1=%month%
set day1=%day%
set fl =%~3
set /A dts2=(%year1%-2000)*365+(1%month1%-100)*30+(1%day1%-100)
set /A res =%dts%-%dts2%
rem Тут указано кол-во дней хранения (30 дней, после этого срока бэкапы удаляются)
if %res% GTR 30 do (del /Q /F %fl%)
goto q:
rem Подпрограмма преобразования даты
:sub2
IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ("%~1") DO (
SET Year=%%C
SET Month=%%A
SET Day=%%B
)
IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ("%~1") DO (
SET Year=%%C
SET Month=%%B
SET Day=%%A
)
IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ("%~1") DO (
SET Year=%%A
SET Month=%%B
SET Day=%%C
)
FOR %%A IN (%Year%) DO SET Year=%%A
FOR %%A IN (%Month%) DO SET Month=%%A
FOR %%A IN (%Day%) DO SET Day=%%A
if not %year:~-4,1%==2 (set year=20%year%)
goto q:
rem Подпрограмма преобразования времени
:sub3
IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sTime%" %%A IN ("%~1") DO (
SET Hour=%%C
SET Minute=%%A
SET Second=%%B
)
IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sTime%" %%A IN ("%~1") DO (
SET Hour=%%C
SET Minute=%%B
SET Second=%%A
)
IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sTime%" %%A IN ("%~1") DO (
SET Hour=%%A
SET Minute=%%B
SET Second=%%C
)
FOR %%A IN (%Hour%) DO SET Hour=%%A
FOR %%A IN (%Minute%) DO SET Minute=%%A
FOR %%A IN (%Second%) DO SET Second=%%A
if %Hour% LSS 10 (set Hour=0%Hour%)
:q[/codebox]