Pfade anpassen nicht vergessen.
(Ist halt in englisch, weil ich es erst im off. Forum gepostet habe...)
Sollte aber auch nicht so schwer zu verstehen sein...
Code: Alles auswählen
@echo off
echo Delete backups, keep last 20 backups...
set target=D:\TDU
FOR /F "eol=; skip=20 tokens=* delims=," %%i in ('dir %target%\backup_*.* /O:-N /b') do (RMDIR /S /Q %target%\%%i)
pause
@echo off
echo Create backup...
IF NOT EXIST d:\TDU mkdir d:\TDU
set "date=%date:~-4%%date:~-7,2%%date:~-10,2%"
set "time=%time:~0,2%%time:~3,2%%time:~6,2%"
set "time=0%time: =%"
set "time=%time:~-6%"
xcopy "C:\Users\XXXXXXX\Eigene Dokumente\Eden Games\Test Drive Unlimited 2\savegame" "d:\TDU\backup_%date%_%time%\" /s /e >nul
if %errorlevel%==0 goto success
if not %errorlevel%==0 goto error
:error
echo ERROR!
goto exit
:success
echo SUCCESS!
goto exit
:exit
pause