# Include syntax in the .bat script to read the password and run rclone

**URL:** <https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070>\
**Category:** Help and Support\
**Created:** [December 17, 2021, 5:51pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070 "2021-12-17T17:51:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 5:52pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/1 "2021-12-17T17:52:00Z")

</div>

BY DELETING THIS COMMENT, I AM CONFIRMING I HAVE READ THIS AND WILL USE THE TEMPLATE BELOW FOR MY POST.

#### What is the problem you are having with rclone?

I put a password in the configuration, however every time I run the script.bat I need to put the password. I want to either put the password directly into the command or configure the script to read the password.

#### What is your rclone version (output from `rclone version`)
 1.55.1
#### Which cloud storage system are you using? (eg Google Drive)

google drive

#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)

````auto
Paste command here
```c:\rclone\rclone -vP sync --progress C:\pasta gdrive:documentos\office

#### The rclone config contents with secrets removed.  
<!-- You should use 3 backticks to begin and end your paste to make it readable. -->

````

Paste config here

```auto

RCLONE_ENCRYPT_V0:
fbbNvbCnrFxaE2v2jy2DzHx+oDT3ew/TmYtlAwKnmQLD0Pa0RmTFjRkwF5AI4E79GkTbrPiFzBrfJ1DINbIveXBBWy0HtT8Ae4Ylkzo4VvCiVA6bCjeZWXElSESwZnAuvOuIzsAuAlfq3eues5OzsMJZsxU6co+DZSyJpt/TahH24xq/4T2IPCuicdQ9t41+kI5aJyNscq/MvKBA1SAWK+3Kq9seqOV53ibi5W8EliHthv/uRJ1s9pcYgpFiRg/vWF6GdnXyQ/4QuM5LTFX+TIzZ4gNryVaiUKD4AtnJSGsCrULIqvwVcHGnUGo3IJ0ZBBb+cP64HUzKoxqiuG+DPBn15FSxKQKmfA8DxEA9EtdPAaCxLnrWhDfJ9rEP5igb6NDI4E3H6koZtliFV3FfThsGqFIikEf3Bk3DU8L4lS/QGw5wKmhgs5MmnMH31s1uujuWZpnF6af876OLzF5i+2/l0IKzBx7IxqZekE0vgbnfqN98E6Bo3NOy3ReFLHil4ZTuHxGcLgS8Yg3OkO8G09hFjfJP+/yvHYYk+FUUS+ThC7Fyca+Y0Xj13E4LT5T1LxP9Iaye7xWkEvTGtQmNiF+Np/BWqQ7keo/Z2LdP2vo1

#### A log from the command with the `-vv` flag  
<!-- You should use 3 backticks to begin and end your paste to make it readable. Or use a service such as https://pastebin.com or https://gist.github.com/ -->

```

Paste log here

```auto

```

---

<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:** [December 17, 2021, 6:21pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/2 "2021-12-17T18:21:46Z")

</div>

hi,

in each case, replace `password` with the rclone config encryption password  
1.

```auto
set RCLONE_CONFIG_PASS=password
c:\rclone\rclone -vP sync --progress C:\pasta gdrive:documentos\office

```

1. 

```auto
echo password | c:\rclone\rclone -vP sync --progress C:\pasta gdrive:documentos\office

```

and the latest rclone is v1.57.0

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 7:49pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/3 "2021-12-17T19:49:06Z")

</div>

set RCLONE\_CONFIG\_PASS=testedesenha

C:\rclone\>echo password | c:\rclone\rclone -vP sync --progress C:\pasta gdrive:documentos\office  
2021/12/17 16:46:28 ERROR : Failed to save config after 10 tries: Failed to move previous config to backup location: rename C:\Users\servidor.config\rclone\rclone.conf C:\Users\servidor.config\rclone\rclone.conf.old: O arquivo já está sendo usado por outro processo.

---

<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:** [December 17, 2021, 8:02pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/4 "2021-12-17T20:02:20Z")

</div>

```auto
set RCLONE_CONFIG_PASS=password 

rclone listremotes
remote:

```

```auto
echo password | rclone listremotes
remote:

```

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 10:30pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/5 "2021-12-17T22:30:50Z")

</div>

> [@asdffdsa](#):
>
> `set RCLONE_CONFIG_PASS`

I need that too.  
I need to encrypt rclone.conf so no one can use my configuration and I need to run the command inside an executable script.  
I do the script without problems, but I don't know how to handle the rclone commands inside the script so that it doesn't ask for the password

---

<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:** [December 17, 2021, 10:33pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/6 "2021-12-17T22:33:28Z")

</div>

sorry, not sure what you need help with?  
let's do this one step at a time.

1. you need to encrypt the rclone.conf file, correct?

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 10:38pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/7 "2021-12-17T22:38:34Z")

</div>

yea.  
I already put password in rclone.conf  
so that every time I run the command to sync to the cloud, it asks for the password.  
so far so good

---

<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:** [December 17, 2021, 10:46pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/8 "2021-12-17T22:46:14Z")

</div>

you seem to be posting twice, in this topic and also [here](https://forum.rclone.org/t/possible-to-set-a-password-for-the-rclone-config-file-without-using-rclone-config-2/27703/14)  
this is confusing, so plesae do not post twice, just post here

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 10:50pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/9 "2021-12-17T22:50:53Z")

</div>

ok, sorry my friend.  
I really need this

---

<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:** [December 17, 2021, 10:52pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/10 "2021-12-17T22:52:09Z")

</div>

friend, no problem.

so you already encrypted the rclone.conf file, correct?

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 10:52pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/11 "2021-12-17T22:52:58Z")

</div>

yes, i already encrypted

---

<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:** [December 17, 2021, 10:54pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/12 "2021-12-17T22:54:23Z")

</div>

> [@tilinux0](#):
>
> every time I run the command to sync to the cloud, it asks for the password.

i shared two scripts to work around that, what was wrong with both of them?

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 10:55pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/13 "2021-12-17T22:55:34Z")

</div>

sorry, i didn't see these scripts. can post here 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:** [December 17, 2021, 10:57pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/14 "2021-12-17T22:57:34Z")

</div>

assuming that `testedesenha` is the password you used to encrypt the rclone.conf

1. 

```auto
set RCLONE_CONFIG_PASS=testedesenha

rclone listremotes
remote:

```

* * *

1. 

```auto
echo testedesenha | rclone listremotes
remote:

```

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 11:01pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/15 "2021-12-17T23:01:27Z")

</div>

Perfect,  
but how would i assemble this script?

Name archive: backup.bat  
set RCLONE\_CONFIG\_PASS=testedesenha  
rclone listremotes  
c:\rclone\rclone -vP sync --progress C:\pasta gdrive:DOCUMENTOS\OFFICE

---

<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:** [December 17, 2021, 11:05pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/16 "2021-12-17T23:05:33Z")

</div>

for `backup.bat`. let's start with something simple

```auto
set RCLONE_CONFIG_PASS=testedesenha
c:\rclone\rclone listremotes -vv

```

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 11:14pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/17 "2021-12-17T23:14:46Z")

</div>

echo off  
cls  
set RCLONE\_CONFIG\_PASS=testedesenha  
c:\rclone\rclone listremotes -vv  
c:\rclone\rclone -vP sync --progress C:\pasta gdrive:DOCUMENTOS\OFFICE

it seems to me that this is the best way, but,  
the password is recorded in windows. just give the set command and it is there for anyone

---

<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:** [December 17, 2021, 11:16pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/18 "2021-12-17T23:16:24Z")

</div>

> [@tilinux0](#):
>
> it is there for anyone

in another topic, i think you mentioned that the computer is a shared with others users, correct?  
if true, really, there is no good solution to your problem.

---

<div class="post-metadata">

**Author:** ![tilinux0](https://forum.rclone.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tilinux0](https://forum.rclone.org/u/tilinux0)\
**Post date:** [December 17, 2021, 11:22pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/19 "2021-12-17T23:22:36Z")

</div>

not necessarily. I need to prevent any user from messing with the script and altering it and causing harm.

---

<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:** [December 17, 2021, 11:25pm UTC](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070/20 "2021-12-17T23:25:27Z")

</div>

perhaps search the internet for `convert .bat to .exe`

for example,  
[https://www.howtogeek.com/50364/convert-a-batch-bat-script-to-an-executable-exe-file/](https://www.howtogeek.com/50364/convert-a-batch-bat-script-to-an-executable-exe-file/)  
[https://www.thewindowsclub.com/convert-bat-to-exe-file-windows](https://www.thewindowsclub.com/convert-bat-to-exe-file-windows)

[Next page](https://forum.rclone.org/t/include-syntax-in-the-bat-script-to-read-the-password-and-run-rclone/28070.md?page=2)
