Template scripts for Windows 10 user

Here is a batch file that is working for me on Windows 10 Pro 64 bit Version 20H2.

Save restic.exe on your Desktop. I use v0.12.0

Create a text file and save to your Desktop as mybackup.cmd

@echo off

net session >nul 2>&1 & if errorlevel 1 echo Failed: Must right click and Run As Administrator & goto end
cd %USERPROFILE%\Desktop

set AWS_ACCESS_KEY_ID=MY_ACCESS_KEY_ID
set AWS_SECRET_ACCESS_KEY=MY_SECRET_ACCESS_KEY
set RESTIC_PASSWORD=ABCDEF123456
set RESTIC_REPOSITORY=d:\myrepo

if not exist d:\myrepo\. mkdir d:\myrepo && restic init

restic backup %USERPROFILE%\Desktop %USERPROFILE%\Documents --use-fs-snapshot  

:end
pause

You must run the batch file as Administrator, to do that right click the batch file and choose Run as administrator.

1 Like