You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A way to make Rclone run in the background on Windows #5175
I don't know if you have seen these? Do you think there should be more done, with regards to functionality and/or documentation?
I have started a pull request for detailed documentation of automatic running of rclone, which includes running in background but with main focus on starting on windows startup or on schedule etc.. My attempt has sort of stranded, though, because it turned out to be difficult to find a consistent behavior accross different versions of Windows etc, and then a detailed doc like this needs to considere these differences - or be rewritten to be much less detailed. See:
I see, that can be a bit confusing. But that sentence is related to the --daemon flag and internals of the mount command (don't know enough of the details myself). The --no-console flag, and the other "third party" methods discussed in the forum thread, are unrelated to this, as these will just hide the console window that rclone creates, while doing nothing with how the process itself runs (which I think the --deamon option does).
OK, I see. Although VBS scripts are also useful, Rclone itself can solve this problem better. Or you can use VBS as a common method for all Windows versions (I don't know about it, and I don't know if it's possible 🤣).
I don't think we will ever implement --daemon flag on Windows as is, since Unix daemon semantics is too different from a Windows service.
Currently a good solution is to use nssm. It may be partially described in rclone docs by PR #4972 when it gets merged.
If some day we decide to embed the Windows service feature in rclone, we can probably base it on one of the following:
I guess we will also need to use registry to keep service state and coordinate with the WinFSP manager. This will introduce a number of windows-specific command-line flags. This is not as easy as it may seem.
Even on Linux the --daemon flag currently doesn't work with the mount command or in the --rc mode. It will be fixed by the relevant tickets (#2968, #2618).
Kinda sad that this still isn't supported by default.
Using task scheduler is good, but unmounting is a pain, using a windows service is easier as you can just stop the service and it'll unmount properly. Setting up a regular service is almost perfect for me. But it might not be desirable if you have multiple users in your PC.
$params = @{
Name = "Rclone-Mount"
BinaryPathName = "rclone-path arguements"
DisplayName = "Rclone"
StartupType = "Automatic"
Description = "This is a test service."
Credential = "DOMAIN\USER"
}
New-Service @params
I had to run the service with user credentials or rclone wouldn't write to existing files. But this is the best workaround I've found yet, no flashing cmd either.
Kinda sad that this still isn't supported by default.
Using task scheduler is good, but unmounting is a pain, using a windows service is easier as you can just stop the service and it'll unmount properly. Setting up a regular service is almost perfect for me. But it might not be desirable if you have multiple users in your PC.
$params = @{
Name = "Rclone-Mount"
BinaryPathName = "rclone-path arguements"
DisplayName = "Rclone"
StartupType = "Automatic"
Description = "This is a test service."
Credential = "DOMAIN\USER"
}
New-Service @params
I had to run the service with user credentials or rclone wouldn't write to existing files. But this is the best workaround I've found yet, no flashing cmd either.
@Kein : I'm not sure if this is what you refer to, but rclone is still a console application, so even with --no-console it will in fact still need to allocate a console, only to hide it early on in the application's initialization code. Please share more details, show an example, if you meant something else or have further questions.
Here is alternative solution that does not require a service, only 2 files.
Fist you need the mount command. For that we will use a .bat file. Lets call it mount_cloud.bat Here is the sample code:
@echo off
rclone mount cloud: W: --vfs-cache-mode full --no-console --vfs-cache-max-size 50G --vfs-cache-max-age 24h
dont forget to replace replace cloud: with your remote name, and W: with the drive letter that you want to assign to your drive.
this will run your rclone mount command with the --no-console parameter so it won't have a console window open.
Then we need a VBS script that will run the command for you. So the terminal window will remain hidden.
Lets call the second file mount_rclone.vbs here is the code:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\rclone\mount_cloud.bat" & chr(34), 0
Set WshShell = Nothing
Replace the C:\rclone\mount_cloud.bat with the correct path where you stored the previous file.
You can also copy/paste the second line if you want to mount multiple drives at once.
Then in Windows Task Scheduler run the mount_rclone.vbs after you logon or whenever you want this to be triggered. (I think that if you make a shortcut in startitems will work too, but I haven't tried it)
And you can make your windows mount automatically your rclones and it will stay in the background.
No console windows. No services. Just files.
Here is alternative solution that does not require a service, only 2 files.
Fist you need the mount command. For that we will use a .bat file. Lets call it mount_cloud.bat Here is the sample code:
@echo off
rclone mount cloud: W: --vfs-cache-mode full --no-console --vfs-cache-max-size 50G --vfs-cache-max-age 24h
dont forget to replace replace cloud: with your remote name, and W: with the drive letter that you want to assign to your drive. this will run your rclone mount command with the --no-console parameter so it won't have a console window open.
Then we need a VBS script that will run the command for you. So the terminal window will remain hidden. Lets call the second file mount_rclone.vbs here is the code:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\rclone\mount_cloud.bat" & chr(34), 0
Set WshShell = Nothing
Replace the C:\rclone\mount_cloud.bat with the correct path where you stored the previous file. You can also copy/paste the second line if you want to mount multiple drives at once.
Then in Windows Task Scheduler run the mount_rclone.vbs after you logon or whenever you want this to be triggered. (I think that if you make a shortcut in startitems will work too, but I haven't tried it) And you can make your windows mount automatically your rclones and it will stay in the background. No console windows. No services. Just files.
@fxzxmic What do you think is still missing in rclone?
As I see it, simply starting rclone with --no-console is a ready to use, super easy solution to this. The built-in support for installing rclone as a Windows service, using PowerShell's New-Service command, is almost just as easy, if you want more automated execution. This is all documentation at https://rclone.org/install/#autostart now. And in addition, classic Windows tricks with Windows/VB Script, PowerShell, or something else is well covered in rclone forum, and on the internet in general. I fail to see a need for anything more? But I may be missing some specific detail, specific use case, or something?
Activity
albertony commentedon Mar 28, 2021
There was a discussion in the forum where some options are mentioned, including the VBScript approach similar to yours, see:
Then, after that we added a command line argument
--no-console, which should be available in latest version of rclone. See:I don't know if you have seen these? Do you think there should be more done, with regards to functionality and/or documentation?
I have started a pull request for detailed documentation of automatic running of rclone, which includes running in background but with main focus on starting on windows startup or on schedule etc.. My attempt has sort of stranded, though, because it turned out to be difficult to find a consistent behavior accross different versions of Windows etc, and then a detailed doc like this needs to considere these differences - or be rewritten to be much less detailed. See:
fxzxzyra commentedon Mar 28, 2021
https://rclone.org/commands/rclone_mount/
It's mentioned:
You can only run mount in foreground mode on Windows.So I don't know the new way.
albertony commentedon Mar 28, 2021
I see, that can be a bit confusing. But that sentence is related to the
--daemonflag and internals of the mount command (don't know enough of the details myself). The--no-consoleflag, and the other "third party" methods discussed in the forum thread, are unrelated to this, as these will just hide the console window that rclone creates, while doing nothing with how the process itself runs (which I think the--deamonoption does).fxzxzyra commentedon Mar 28, 2021
OK, I see. Although VBS scripts are also useful, Rclone itself can solve this problem better. Or you can use VBS as a common method for all Windows versions (I don't know about it, and I don't know if it's possible 🤣).
ivandeex commentedon Mar 28, 2021
I don't think we will ever implement
--daemonflag on Windows as is, since Unix daemon semantics is too different from a Windows service.Currently a good solution is to use nssm. It may be partially described in rclone docs by PR #4972 when it gets merged.
If some day we decide to embed the Windows service feature in rclone, we can probably base it on one of the following:
I guess we will also need to use registry to keep service state and coordinate with the WinFSP manager. This will introduce a number of windows-specific command-line flags. This is not as easy as it may seem.
Even on Linux the
--daemonflag currently doesn't work with themountcommand or in the--rcmode. It will be fixed by the relevant tickets (#2968, #2618).ivandeex commentedon Mar 28, 2021
fxzxzyra commentedon Mar 28, 2021
Okay, thank you. Do I need to close this Issue? Or keep it open? I think my goal has been reached and my question has been resolved.
ivandeex commentedon Mar 28, 2021
Another workaround was published by you at https://translate.google.com/translate?sl=zh-CN&tl=en&u=https://fxic.iblog.ink/articles/page/147.html
A number of other solutions can be extracted from https://forum.rclone.org/
fxzxzyra commentedon Mar 28, 2021
EDIT: new domain: https://fxzx.iblog.ink/articles/page/147.html
Ha ha, you found it. Thanks. 😂🤣
MaxJahWn commentedon Jul 22, 2023
I‘ve configured
powershell -Command "Start-Process -FilePath rclone -WindowStyle hidden -ArgumentList \"mount MyWebdav: Z: --network-mode {{other arguments}}\""in taskschd.msc, it works well.
fredinj commentedon Oct 19, 2023
Kinda sad that this still isn't supported by default.
Using task scheduler is good, but unmounting is a pain, using a windows service is easier as you can just stop the service and it'll unmount properly. Setting up a regular service is almost perfect for me. But it might not be desirable if you have multiple users in your PC.
I had to run the service with user credentials or rclone wouldn't write to existing files. But this is the best workaround I've found yet, no flashing cmd either.
fxzxzyra commentedon Oct 19, 2023
I’m glad you shared your method.
Kein commentedon Mar 26, 2024
It does not work under Windows, it opens cmd prompt asking to run under cmd/shell
albertony commentedon Mar 26, 2024
@Kein : I'm not sure if this is what you refer to, but rclone is still a console application, so even with
--no-consoleit will in fact still need to allocate a console, only to hide it early on in the application's initialization code. Please share more details, show an example, if you meant something else or have further questions.DawnImpulse commentedon May 29, 2024
I have found a way to basically start any cli service in background - https://github.com/jeansaad/chalet
Using this tool we can configure any cli command & use it in background (only caveat is you have to start it after every PC restart)
also for a simple tray icon to start/stop services - https://github.com/macav/hotelier
ANDiTKO commentedon Jul 14, 2024
Here is alternative solution that does not require a service, only 2 files.
Fist you need the mount command. For that we will use a .bat file. Lets call it mount_cloud.bat Here is the sample code:
dont forget to replace replace cloud: with your remote name, and W: with the drive letter that you want to assign to your drive.
this will run your rclone mount command with the --no-console parameter so it won't have a console window open.
Then we need a VBS script that will run the command for you. So the terminal window will remain hidden.
Lets call the second file mount_rclone.vbs here is the code:
Replace the C:\rclone\mount_cloud.bat with the correct path where you stored the previous file.
You can also copy/paste the second line if you want to mount multiple drives at once.
Then in Windows Task Scheduler run the mount_rclone.vbs after you logon or whenever you want this to be triggered. (I think that if you make a shortcut in startitems will work too, but I haven't tried it)
And you can make your windows mount automatically your rclones and it will stay in the background.
No console windows. No services. Just files.
fxzxzyra commentedon Jul 14, 2024
Since Windows will deprecate VBS, the only way to make Rclone run in the background in the future is to use a service.
jason-eu commentedon Nov 14, 2024
THANK YOU !
albertony commentedon Nov 26, 2024
@fxzxmic What do you think is still missing in rclone?
As I see it, simply starting rclone with
--no-consoleis a ready to use, super easy solution to this. The built-in support for installing rclone as a Windows service, using PowerShell'sNew-Servicecommand, is almost just as easy, if you want more automated execution. This is all documentation at https://rclone.org/install/#autostart now. And in addition, classic Windows tricks with Windows/VB Script, PowerShell, or something else is well covered in rclone forum, and on the internet in general. I fail to see a need for anything more? But I may be missing some specific detail, specific use case, or something?saintech commentedon Jul 1, 2025
There is also this way using the scheduler: