Backup-Manager for GLBasic :)

Previous topic - Next topic

Schranz0r

This is a Backup-Manager on a macro (batchfile).
It use a menu to do some stuff :D

If you use it, you have to edit a line:

SET backuppath=C:\GLB_Backups

for example:

SET backuppath=D:\MyStuff\GLB_Backups

The full MACRO:

Code (glbasic) Select
:: Backupmanager

@ECHO OFF

:: Set the backuppath (you can edit it!)
SET backuppath=C:\GLB_Backups

:start
CLS
ECHO Backupmanager by -Schranz0r- www.glbasic.com
ECHO.
ECHO [1] save and exit
ECHO [2] save and open backupfolder
ECHO [3] open backupfolder
ECHO [0] close
ECHO.
ECHO -------------------------------
ECHO.

set /P menu="select what you want to do: "

IF /I "%menu%" == "1" GOTO save_exit
IF /I "%menu%" == "2" GOTO save_open
IF /I "%menu%" == "3" GOTO open
IF /I "%menu%" == "0" GOTO close
IF /I "%menu%" == "" GOTO start



:: ------------------------------------------------------------------ SAVE & EXIT -
:save_exit

:: clear the screen
CLS

:: Display some stuff on the console ;)
ECHO Copy project %GLB_PROJ_NAME% to %backuppath%\%GLB_PROJ_NAME%

:: Create the directory for the backup if it not exist
IF NOT EXIST "%backuppath%\%GLB_PROJ_NAME%\" MKDIR "%backuppath%\%GLB_PROJ_NAME%\"

:: Copy the project to th backup-folder
XCOPY "%GLB_PROJ_PATH%\*.*" "%backuppath%\%GLB_PROJ_NAME%\" /E/Y

:: wait for a keyhit
PAUSE
EXIT /B



:: ------------------------------------------------------------------- SAVE & OPEN -
:save_open

:: clear the screen
CLS

:: Display some stuff on the console ;)
ECHO Copy project %GLB_PROJ_NAME% to %backuppath%\%GLB_PROJ_NAME%

:: Create the directory for the backup if it not exist
IF NOT EXIST "%backuppath%\%GLB_PROJ_NAME%\" MKDIR "%backuppath%\%GLB_PROJ_NAME%\"

:: Copy the project to th backup-folder
XCOPY "%GLB_PROJ_PATH%\*.*" "%backuppath%\%GLB_PROJ_NAME%\" /E/Y

:: open the explorer and go to the backupfolder
%SystemRoot%\explorer.exe /e,%backuppath%

:: exit the batchfile (Macro)
EXIT /B


:: ------------------------------------------------------------------------- OPEN -
:open

:: clear the screen
CLS

:: open the explorer and go to the backupfolder
%SystemRoot%\explorer.exe /e,%backuppath%

:: exit the batchfile (Macro)
EXIT /B


:: ------------------------------------------------------------------------ CLOSE -
:close

CLS
EXIT /B
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

Nice, if you download the latest beta from the frontpage, macro is working for english users too.

Schranz0r

#2
Thx for the info ;)

I update the first post and add some stuff  :whistle:
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Hemlos

Thanks Schranzor,

I altered your code a little to make it work for my computer a little better.

Code (glbasic) Select
:: Backupmanager

@ECHO OFF

:: Set the backuppath (you can edit it!)
color 1F
md Backup
SET backuppath=%GLB_PROJ_PATH%\Backup

:start
CLS
TITLE Backupmanager For GLBasic
ECHO.
ECHO [1] save and exit
ECHO [2] save and open backupfolder
ECHO [3] open backupfolder
ECHO [0] close
ECHO.
ECHO -------------------------------
ECHO.

set /P menu="select what you want to do: "

IF /I "%menu%" == "1" GOTO save_exit
IF /I "%menu%" == "2" GOTO save_open
IF /I "%menu%" == "3" GOTO open
IF /I "%menu%" == "0" GOTO close
IF /I "%menu%" == "" GOTO start



:: ------------------------------------------------------------------ SAVE & EXIT -
:save_exit

:: clear the screen
CLS

:: Display some stuff on the console ;)
ECHO Copy project %GLB_PROJ_NAME% to %backuppath%

:: Copy the project to the backup-folder
COPY "%GLB_PROJ_PATH%\*.*" "%backuppath%"

:: wait for a keyhit
PAUSE
EXIT /B



:: ------------------------------------------------------------------- SAVE & OPEN -
:save_open

:: clear the screen
CLS

:: Display some stuff on the console ;)
ECHO Copy project %GLB_PROJ_NAME% to %backuppath%\%GLB_PROJ_NAME%

:: Copy the project to th backup-folder
COPY "%GLB_PROJ_PATH%\*.*" "%backuppath%"

:: open the explorer and go to the backupfolder
%SystemRoot%\explorer.exe /e,%backuppath%

:: exit the batchfile (Macro)
EXIT /B


:: ------------------------------------------------------------------------- OPEN -
:open

:: clear the screen
CLS

:: open the explorer and go to the backupfolder
%SystemRoot%\explorer.exe /e,%backuppath%

:: exit the batchfile (Macro)
EXIT /B


:: ------------------------------------------------------------------------ CLOSE -
:close

CLS
EXIT /B
Bing ChatGpt is pretty smart :O