Autostart rclone mount on Windows

I found a rather easy way to somewhat daemonize rclone mount on Windows, so sharing it here.

We will be running rclone mount on system startup using an autostarted batch file. Usually, the console would remain visible, but there's a way to "daemonize" this (thus, no application in the foreground visible).

  1. Download & extract SilentCMD
  2. Press the keys: Windows+R
  3. Run: "shell:startup", it will open the autostart folder
  4. Create a new batch file there, e.g. ZDriveMapper.cmd
  5. Enter the following content (adjust the paths):
start  C:\programs\SilentCMD\SilentCMD.exe C:\programs\rclone\rclone.exe mount REMOTE:BUCKET Z: -o volname=RemoteDrive >> "%TMP%\ZDriveMapperLog.txt" 2>&1 /LOG+:%TMP%\ZDriveMapperLog.txt

Note: You will have to modify the paths to SilentCMD.exe, rclone.exe (or add them to %PATH%), as well as the name of the remote and the bucket, if any needed.

Note: If you want to mount multiple remotes in different volumes, just add multiple such batch files each mounting a different volume. Or combine multiple remotes to show them all within a single volume.


@ncw is this method worth to mention in the rclone documentation?

2 Likes

That looks like a very easy way to start things on Windows. What user does it run the mount as? Getting that right is often a problem.

Note that the --no-console flag hides the terminal window under Windows. I think this is missing from the documentation though!

What to do windows experts think? @albertony ?

3 Likes

There is some documentation, and it mentions --no-console as well as alternatives using task scheduler and setting up as windows service:

I haven't tried SilentCMD myself, but I think e.g. NirSoft AdvancedRun can be used in a similar setup. In general there are many alternatives and variants... Perhaps it a wiki page would be most appropriate (maybe there even is one already...)?

1 Like

Ah, I see. I guess, I missed that one and only saw the solution using New-Service which in my case doesn't work even when running PowerShell in elevated mode and is a needless hassle. So, thanks for pointing both the --no-console as well as the autostart method in the documentation.

SilentCMD is not necessary with --no-console set. This works just as fine:

rclone.exe mount REMOTE: Z: -o volname=RemoteDrive --no-console --vfs-used-is-size --log-file "%TMP%\ZDriveMapperLog.txt"

So, I see no gain in mentioning the SilentCMD method in the documentation or wiki. Apart from adding a dependency to another tool, it gives no additional benefit. However, it would be nice to mention --no-console in rclone mount.

Also, in Install, the link to mount points to move instead. It's perhaps worth updating the link.

That is probably a good idea.

Definitely, thanks for reporting.

hi,

if i understand slientcmd, then the downsides are
--- silentcmd runs after the user has logged in.
whereas, task scheduler and nssm, can run before the user has logged in, at system startup.
--- have not been updated in three years.

anything from nirsoft is good.
to hide the console, i have used nircmd

Nice! I was expecting to find docs in Documentation - maybe we need something there as well?

what is the use of --vfs-used-is-size? is it necessary?

hello and welcome to the forum,

https://rclone.org/commands/rclone_mount/#vfs-disk-options
"Use it as a last resort"

necessary for what?
what is the problem you are trying to solve?

Is it necessary for a simple mount with default settings and a log file? Is that option limits the size of log file? I mean, what is the reason to add --vfs-used-is-size in the code? I want to understand details and what I see at documentation is --vfs-used-is-size rclone size and not only --vfs-used-is-size without any size defined.

Okay, my case is this: I used this code to mount my onedrive folder:

rclone mount REMOTE:/myFolder Z:/myFolder --vfs-cache-mode full --no-console

however, I cannot sync myFolder bidirectionally. Any way for that?

please start a new topic using help and support template and answer all the questions.

okay, I will do that so... :slight_smile:

rclone mount Onedrive5TB1: Z: --vfs-cache-mode full --no-console

of course i searched for rclone.exe and copied as path into PATH
without / ( but \ would be right anyway ) worked it like a charm

i like these commands as simple as possible because this way they are better memorable