# How to "automatize" rclone?

**URL:** <https://forum.rclone.org/t/how-to-automatize-rclone/14181>\
**Category:** Help and Support\
**Created:** [February 4, 2020, 6:38pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181 "2020-02-04T18:38:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 4, 2020, 6:38pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/1 "2020-02-04T18:38:20Z")

</div>

Hi all!  
I have got a question but, first, I'll explain why I am using rclone.  
I need a program to do 2 things:

1. Backup my local files to GDrive
2. Server-side copy files from a GDrive to another

For the first thing I tried to use "GDrive Backup and Sync" but it has some problems, so I found rclone

Well, I would like to let rclone work continuously but I've seen that this isn't possible. So, I was looking for a way to "automatize" rclone, like executing the command every hour, but without opening the cmd windows (that can be pretty annoying)

Can you help me?

Thanks 🙂

If it matters, I am using rclone 1.51.0

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 4, 2020, 7:19pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/2 "2020-02-04T19:19:24Z")

</div>

there are many ways to get that done on windows.

this will run rclone, wait 5 seconds and loop over  
write a .cmd batch file and paste this:

> :looper  
> rclone.exe lsd wasabieast2:  
> timeout /T 5 \> nul  
> goto looper

if you want to run the script at system start.

1. use task scheduler - easy
2. use nssm - complex

this is using task scheduler.

 ![image](https://forum.rclone.org/uploads/default/original/2X/7/7badc9f13f46f813a569433b3092f12d5a044ea9.png)

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 4, 2020, 8:45pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/3 "2020-02-04T20:45:46Z")

</div>

Hi! Thanks for your help

> [@asdffdsa](#):
>
> :looper  
> rclone.exe lsd wasabieast2:  
> timeout /T 5 \> nul  
> goto looper

Can you please tell me how does this works?  
I don't know the "cmd language.."  
I mean, I understand the "looper" and "goto looper"  
But... lsd? wasabieast2? timeout /T 5 \> nul?

I mean, if you please can comment/explain I can also personalize this small "script"

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 4, 2020, 8:49pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/4 "2020-02-04T20:49:10Z")

</div>

sure,

1. change `rclone.exe lsd wasabieast2:` to whatever rclone command you want to use.
2. to learn about timeout, from the command line type `timeout /?`
3. by default the timeout command prints output to the command line, using `>nul` hides that output.  
try this `timeout /T 5` and see what happens

[https://ss64.com/nt/timeout.html](https://ss64.com/nt/timeout.html)  
[https://ss64.com/nt/goto.html](https://ss64.com/nt/goto.html)  
[https://ss64.com/nt/syntax-redirection.html](https://ss64.com/nt/syntax-redirection.html)

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 4, 2020, 9:57pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/5 "2020-02-04T21:57:04Z")

</div>

Understood, thanks 🙂

Do you know if there is a way to execute the .cmd without opening the window? So, like a "silent" mode I don't know how to call it.. Just execute the program in the background

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 4, 2020, 9:59pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/6 "2020-02-04T21:59:45Z")

</div>

yes, use task scheduler.  
click the hidden check box

 ![image](https://forum.rclone.org/uploads/default/original/2X/2/222fcc417624687e144b2783af2be1f7c907e3b0.png)

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 4, 2020, 10:14pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/7 "2020-02-04T22:14:29Z")

</div>

Understood thanks 🙂  
Last things..

> :looper  
> rclone.exe copy folder1 folder2  
> rclone.exe copy folder3 folder4  
> rclone.exe copy folder5 folder6  
> timeout /T 5 \> nul  
> goto looper

This works in this way  
First of all, the first copy starts  
When the first copy has finished his job, then the second copy starts  
Same thing, when the second copy has finished his job, then the third copy starts  
Then it will wait 5 second and loop, right? Each copy waits for the previous copy to finish, right?

Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 4, 2020, 10:27pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/8 "2020-02-04T22:27:52Z")

</div>

each command is run one at a time, when that command is finished, the next command is run.

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 4, 2020, 10:40pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/9 "2020-02-04T22:40:52Z")

</div>

Really, really, really thanks!

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 4, 2020, 11:09pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/10 "2020-02-04T23:09:00Z")

</div>

sure,  
i was thinking about it and i suggest that you use this for the timeout.

timeout /t 5 /nobreak \> nul

/NOBREAK Ignore key presses and wait specified time.

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 5, 2020, 1:38pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/11 "2020-02-05T13:38:55Z")

</div>

Yeah that's nice! Really thanks 🙂

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 5, 2020, 2:57pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/12 "2020-02-05T14:57:57Z")

</div>

> [@asdffdsa](#):
>
> yes, use task scheduler.

I just finished setting up, all works except this thing  
I checked the "hidden" box, but the "cmd windows" continues appearing every time..

---

<div class="post-metadata">

**Author:** ![thestigma](https://forum.rclone.org/user_avatar/forum.rclone.org/thestigma/32/3414_2.png) [@thestigma](https://forum.rclone.org/u/thestigma)\
**Post date:** [February 5, 2020, 3:11pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/13 "2020-02-05T15:11:13Z")

</div>

I am not sure what that "hidden" box actually does to be honest... maybe it just hides the process or something.

But if you select that the user that runs the script is SYSTEM instead of your user then it will not show up at all. It will just work in the background. You can select this in task scheduler (first options screen).

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 5, 2020, 3:21pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/14 "2020-02-05T15:21:30Z")

</div>

Well.. This way rclone doesn't start at all, or better, it starts for 1 second and closes immediately

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 5, 2020, 3:34pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/15 "2020-02-05T15:34:30Z")

</div>

check task mananger, see if rclone.exe is running in the background

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 5, 2020, 3:34pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/16 "2020-02-05T15:34:55Z")

</div>

Ye I checked with task manager, rclone.exe appears for 1 seconds and closes..

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 5, 2020, 3:36pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/17 "2020-02-05T15:36:33Z")

</div>

make sure you use a log with rclone.  
check the log.

---

<div class="post-metadata">

**Author:** ![thestigma](https://forum.rclone.org/user_avatar/forum.rclone.org/thestigma/32/3414_2.png) [@thestigma](https://forum.rclone.org/u/thestigma)\
**Post date:** [February 5, 2020, 3:58pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/18 "2020-02-05T15:58:20Z")

</div>

I think I know what the problem is...  
When you use a user account (like you normally would if you ran it in windows) the script will start in whereever the file was located.  
But I think system account will always start in C:\windows\system32 - and there is no rclone.exe file here so it will get very confused and error/exit.

To fix that, just add a line that spesifically tells the script which folder it should be working in ( I have added an extra line at the top compared to the earlier example:

```
::First of all, go to the rclone folder
cd c:\rclone

:looper
rclone.exe copy folder1 folder2
rclone.exe copy folder3 folder4
rclone.exe copy folder5 folder6
timeout /T 5 > nul
goto looper

```

Protip - you can comment your own code for easier readability.  
Any line that starts with :: or REM will be ignored by the program.

::This is a comment that does nothing  
REM This is also a comment that does nothing

But a line like this in the code will error... because batch does not know what a "But" is ... _juvenile snickering_

---

<div class="post-metadata">

**Author:** ![Fefolino](https://forum.rclone.org/user_avatar/forum.rclone.org/fefolino/32/4823_2.png) [@Fefolino](https://forum.rclone.org/u/Fefolino)\
**Post date:** [February 5, 2020, 4:36pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/19 "2020-02-05T16:36:33Z")

</div>

Yes but..  
Well, I already found out this thing, because the cmd wasn't working on startup.. So I changed the file with those extra 2 lines at the beginning  
This is my full file

```
G:
cd G:\Programs\ProgrammiNonInstallati\rclone-v1.51.0-windows-amd64
:looper
rclone copy "Musica - ccsf:" "Musica - swccd:" --drive-stop-on-upload-limit
rclone copy "Musica - ccsf:" "Musica - g-suit:" --drive-stop-on-upload-limit

rclone copy "Roba - ccsf:" "Roba - swccd:" --drive-stop-on-upload-limit
rclone copy "Roba - ccsf:" "Roba - g-suit:" --drive-stop-on-upload-limit

rclone copy "RRROBA - ccsf:" "RRROBA - g-suit:" --drive-stop-on-upload-limit
rclone copy "RRROBA - ccsf:" "RRROBA - g-suit:" --drive-stop-on-upload-limit

rclone copy "Streaming - ccsf:" "Streaming - g-suit:" --drive-stop-on-upload-limit
rclone copy "Streaming - ccsf:" "Streaming - swccd:" --drive-stop-on-upload-limit

rclone copy "Musica - ccsf:" "Unipi:" --drive-stop-on-upload-limit
rclone copy "Roba - ccsf:" "Unipi:" --drive-stop-on-upload-limit
rclone copy "Streaming - ccsf:" "Unipi:" --drive-stop-on-upload-limit

timeout /t 3600 /nobreak > nul
goto looper

```

But the problem with SYSTEM user was still there  
So, I google a little and found this  
 ![image](https://forum.rclone.org/uploads/default/original/2X/8/8881723d1649bcb78686d6b545328893fdf857a5.png)  
"Run whether user is logged or or not" yes, but without the second tick (Do not store password)  
And now it works, it runs at startup without opening the cmd window

But also tried to make a second file to mount at startup  
I have to understand how mount works, with cache etc... But this was a try

```
G:
cd G:\Programs\ProgrammiNonInstallati\rclone-v1.51.0-windows-amd64

```

At startup, same settings, it doesn't work if I set "Run whether user is logged on or not"  
It works only with "Run only when user is logged on" but with this config the cmd window opens..  
rclone mount "Roba - ccsf:" X:

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 5, 2020, 6:06pm UTC](https://forum.rclone.org/t/how-to-automatize-rclone/14181/20 "2020-02-05T18:06:12Z")

</div>

my advice is get all your rclone command working 100% then work on task scheduler and starting apps at startup.  
also, you do not need to restart the computer each time to test task scheduler.  
enable run on demand then right click the task and click run.

![image](https://forum.rclone.org/uploads/default/original/2X/b/b934a9bff83988e17647c7389ba9d5c7a2d64b39.png)

if you want to run rclone mount, you should run it as system user, else you might be able to see and use the mount.

[Next page](https://forum.rclone.org/t/how-to-automatize-rclone/14181.md?page=2)
