How to change the path to the config file rclone.cong permanently?

Hello,

I want to use a pendrive with rclone on it, ready to be used.

I tried to move the config file in (i'm on windows) c://(...)/programs files/rclone/rclone.conf .

The problem is when I launch rclone it always use the default path c://user/me/config/rclone/rclone.conf.

I tried this :

rclone --config="C:\Program Files (x86)\rclone\rclone.conf" config

It do open the config, but it look like i would have to do it each time, worst, actually when i try to edit the config i get an error message :

2019/06/01 22:46:41 Failed to save config after 10 tries: Failed to create temp file for new config: open C:\Program Files (x86)\rclone\rclone.conf858589: Access is denied.

I get the same if i try to edit manually with notepad.

can you help me?

You can use an environment variable. I use one to point to a different location other than the default.

RCLONE_CONFIG=/opt/rclone/rclone.conf

1 Like

Thanks. I didn't knew what were environment variable until you told me to work with that, and the only way i found for now to use environment variables is to change it manually in windows (system properties --> environment variable).

My idea is to have the conf file directly in the rclone folder because i will use rclone from a pendrive on different machines.

Is there a possibility to create an .exe that automatically set the conf file path inside the penddrive rclone folder, each time i will open rclone from a new machine?

the thing to understand is that the goal is to have a rclone folder ready to use, and not have to either copy conf file in /conf/ of each machine i'll use rclone, or either having to work with theses unfamiliar environment variable.

My final goal is : Plug pendrive, run cmd and open rclone, start uploading. Finish uploading, unplug pendrive, all fine.

Probably a bit outside the realm of rclone forums.

I'm sure all that is possible as I personally don't use a Windows machine. I'm sure you can google for portable apps or making them and find more solutions.

You can create a launcher script to avoid having to remember to set the --config argument every time.

Example:

  • Create a folder for Rclone on your pendrive, to contain the exe with configuration file and launcher scripts, e.g. D:\Rclone.
  • Put rclone.exe in a subfolder, e.g. "bin" (D:\Rclone\bin\rclone.exe).
  • Create a file with name "rclone.exe.cmd" in the root Rclone folder (D:\Rclone\rclone.exe.cmd) with the following contents:
    @"%~dp0bin\rclone.exe" --config "%~dp0rclone.conf" %*
  • Create a file with name "rclone.cmd" in the same folder (D:\Rclone\rclone.cmd) with the following contents:
    @CALL "%~dpn0.exe%~x0" %*

Now, with Command Prompt in location D:\Rclone you can execute rclone or rclone.exe as normal, and the --config argument will be added automatically making it use configuration file D:\Rclone\rclone.conf. You need to avoid being in location D:\Rclone\bin when you execute rclone commands, as that will execute the rclone.exe directly without going via the launcher script.

Edit: I just created pull request #3245 to avoid having to resort to launcher script(s). If it gets merged you can just put rclone.exe in a folder and create an empty file rclone.conf in the same folder, and it will be used.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.