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?

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 ?

1 Like

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?