.bat file for backup

Hello dear friends, tell me if there is a solution for a bat file for Windows to create a backup? The config file is encrypted with a password, how do I enter the password as a parameter in the bat file? Thank you all!

rclone copy --progress C:\data gdrive:DOCUMENTOS\OFFICE --config C:\Users\MyUsername.config\rclone\rclone.conf --password(im not sure) = "mypass"

like this, but works

welcome to the forum,

set RCLONE_CONFIG_PASS=mypass


rclone is not really a backup program, but a fancy file copier.
i think the closet you will get for backups with rclone and dos batch files is:

@for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
@set datetime=%datetime:~0,4%%datetime:~4,2%%datetime:~6,2%.%datetime:~8,2%%datetime:~10,2%%datetime:~12,2%

rclone sync c:\data gdrive:DOCUMENTOS\OFFICE\current --backup-dir=gdrive:DOCUMENTOS\OFFICE\archive\%datetime%

backup programs on windows creates a vss snapshot and uses that as the source.
rclone cannot create vss snapshots and as a result, cannot copy open, in-use files.

i have a how-to guide, using dos batch file, to enable vss snapshots and use that as the source for rclone
https://forum.rclone.org/t/how-to-enable-vss-for-rclone-on-windows/11675

I really like fancy file copier:)
Please tell me if you have an article on the topic of bat, your solution seems complicated, a regular bat file with a minimum load for a home server. The files that I am going to copy are rarely used, so there is no need for vss.

i just shared a simple three line bat script that will enable incremental backups.

but, if that is too complicated, then use your original command, and perhaps change copy to sync

else the forum is full of examples of .bat files

how to add to your script execution of this line set RCLONE_CONFIG_PASS=mypass?

well, add it to your .bat file

@set RCLONE_CONFIG_PASS=mypass
rclone ...
1 Like

I would ask myself a question why the heck I encrypted my rclone config file and then put my clear text password in another file 5min later:)

Make sure that you have full disk encryption ON and your Windows credentials are strong (ideally with 2FA). Then trust your environment a bit and make your life easier.

good point


on windows, that is done with bitlocker.
the way i have it setup is

  1. full disk using hardware encryption, not software encryption.
  2. to boot, require a key file and a password.
manage-bde.exe -status 
BitLocker Drive Encryption: Configuration Tool version 10.0.26100
Copyright (C) 2013 Microsoft Corporation. All rights reserved.

Disk volumes that can be protected with
BitLocker Drive Encryption:
Volume C: [EN10CDRIVE]
[OS Volume]

    Size:                 140.58 GB
    BitLocker Version:    2.0
    Conversion Status:    Fully Encrypted
    Percentage Encrypted: 100.0%
    Encryption Method:    Hardware Encryption - 1.3.111.2.1619.0.1.2
    Protection Status:    Protection On

actually, FDE makes life less easy for a beginner/newbie.
have to be very well prepared to deal with disasters, as cannot easily use rescue boot using PE, rollback using system restore and so on.
cannot easily remove the hard drive from a dead machine, plug it into a new machine and boot up.

for that, need to use and test, a bare-metal backup that can perform recovery to dissimilar hardware or to VM.
for that, i use free veeam backup and replication.


for many users, it is enough to encrypt the entire user profile or any set of individual folders

2 Likes

Thank you very much for the solution! is it possible to run this .bat in the background?

very welcome.


as for running rclone in background, there are many ways.

  1. rclone --no-console ...
  2. start rclone ...
  3. nircmd exec2 hide rclone ...
  4. using windows task scheduler. has a nice GUI, can run tasks on demand, on a schedule, at boot time, at login, repeat command every x minutes, etc...
    i have written about it in the forum, including screenshots.
1 Like

let me ask you one more question, how to prevent re-uploading of files to the cloud? For example, when the process is interrupted....

rclone does NOT re-upload anything what is already uploaded. Only what is different between source and destination.

So you do not have to do anything.

rclone will not re-upload unchanged files.

each time rclone copy|sync is run, rclone will compare source and dest

with rclone copy, only new files and changed files will be uploaded.
with rclone sync, in addiiton, if a source file is deleted, then the cooresponding file in the dest is deleted.

1 Like

dear friend, how to set several paths for synchronization at once, for example C: and D:? and is it possible to set a network path for downloading, which is specified as follows \\myserver\data?

  1. using rclone combine remote
[cd]
type = combine
upstreams = c=c:\ d=d:\

rclone ls cd:
  1. using native os commads
set root=b:\root
mkdir %root%
mklink /j %root%\c c:\ 
mklink /j %root%\d d:\
subst x: %root%

:: list files on c:\ and d:\ using path
rclone ls %root%

:: list files on c:\ and d:\ using drive letter
rclone ls x:\

I didn't mean that,
rclon sync C:\ D:\ \\mydata\folder gdrive:backup something like that but it works)

that can not work. i shared two workarounds that can work.

it turns out that I can't synchronize several paths at once (in the Windows environment)?

well, i think the two ways i shared, do work on windows.
in the past, i have tested that and posted in the forum about it.


what is your end goal? to backup all files from c: and d: to gdrive?

yes, and also a backup of the WebDAV network path, but as far as I understand this is not supported :frowning: