Skip to content

Instantly share code, notes, and snippets.

@cyanife
Last active October 22, 2017 06:49
Show Gist options
  • Save cyanife/d0a907bf7e079257e00a57ac09269672 to your computer and use it in GitHub Desktop.
Save cyanife/d0a907bf7e079257e00a57ac09269672 to your computer and use it in GitHub Desktop.
Minecraft autobackup script(with Bandizip, Windows 10 SimpCHN)
@ECHO OFF
SETLOCAL
::Minecraft backup script
::(ORIGIN)You need to install 7-Zip first. It can be found here: http://www.7-zip.org/
::(REMASTARED) Using Bandizip instead.
::Please check the path section first before running!
::---------------------------------------------------------------------------------------------------------------------------------------------------------
::Path section
::Set this variable to your Minecraft path. It should be ok for every Windows 7 OS.
set minecraftpath=%APPDATA%\.minecraft
::Set this Variable to you backup location. By default, it generates a backup folder within the minecraft path.
::set backuppath=%APPDATA%\.minecraft\backup
set backuppath=%userprofile%\Desktop\mcsave
::Set this variable to your 7-Zip location
::set zippath="C:\Program Files\7-Zip"
set zippath="C:\myfiles\software\Bandizip"
set worldname=1 cyanife!
::---------------------------------------------------------------------------------------------------------------------------------------------------------
::Script section
::Check if backup Folder exists
IF NOT EXIST %backuppath%\ mkdir %backuppath%
::Check for 7zip
IF NOT EXIST %zippath%\Bandizip.exe (
::echo 7-zip was not found! Please download it from http://7-zip.org/
echo Bandizip was not found! Please download it from http://bandisoft.com/bandizip/
goto EOF
)
::Getting current date and time information
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
set hour=%time:~0,2%
set minute=%time:~3,2%
set second=%time:~6,2%
::Fix hour having a space
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
echo Starting backup...
::Start of the filenames
set filename=%year%-%month%-%day% %hour%-%minute%
::Create the log file header
echo %year%-%month%-%day% @ %hour%:%minute%:%second% >> "%backuppath%\backup.log"
echo. >> "%backuppath%\backup.log"
::Make the backup 7zip and pipe the output to the log
%zippath%\Bandizip.exe a -fmt:7z -l:1 "%backuppath%\%filename%.7z" "%minecraftpath%\saves\%worldname%" >> "%backuppath%\backup.log"
echo Backup done!
start "" "C:\Program Files (x86)\Minecraft\MinecraftLauncher.exe"
exit /B
:EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment