Unmount in Windows

After searching in the forum I had been unable to find an answer. Sorry if I am a bad seeker…

I mount without issue in batch bats. I know that end of batch means unmounting.
I would like to be able to unmount wihout user intervention and in the middle of the bat so to free the drive letter and be able to mount again.

Not found a way to unmount using a rclone command.

I launch the mount as start “LETTER” rclone mount as then I launch other operations in the batch, otherwise if I do not use start rclone mount does not return to the batch until killed.

And to unmount I use, as a workaround of not having rclone unmount, TASKKILL /F /FI “WINDOWTITLE eq LETTER”

While this does the unmount, it has other quirks, such as I cannot use /B (no window) because then I cannot kill the window. Perhaps I could find other ways to launch and the kill, but was unable as today.

Anyone could recommend another wat to unmount in a batch without user intervention?

In rclone mount documentation there are ways for Linux and OS X:
Linux - fusermount -u /path/to/local/mount
OS X -umount /path/to/local/mount

I am not sure if this is posible with rclone or needs to be done a winfsp level.
I identified as interesting elements

https://github.com/billziss-gh/winfsp/issues/47 (winsfp not supporting command line unmmot ?)

TIA
CT

According to the author of WinFSP

The proper way to unmount a file system that uses WinFsp-FUSE is by sending it a Ctrl-C. On Windows this is done by calling GenerateConsoleCtrlEvent . On Cygwin you can also use kill or pkill to send it a SIGTERM , especially if you run it as a Cygwin daemon.

I don’t think there is a windows system way of umounting WinFSP, so no equivalent to umount or fusermount -u.

It might be possible to add, let’s say core/quit to the API which would quit rclone and do the unmount.

Thanks.
I am not sure what means the last phrase…

I cannot see what I can as a user do.

Would it be possible to enhance rclone with a unmount command?

On sending Control-C, I found also several executables that do it. A search for SendSignal and SendControl brings some of them.

I found very interesting

https://web.archive.org/web/20170909040729/http://www.latenighthacking.com/projects/2003/sendSignal/

I will try with
32bits https://www.dropbox.com/s/r96jxglhkm4sjz2/SendSignalCtrlC.exe?dl=0
Clean as today by Virustotal https://www.virustotal.com/#/file/bdd0a7c3f14d1105a81cbb32d75762dd948da10bb227bf27c9c4ff09654ee8a3/detection
(this is for info for those interested; note that your safety is your call do not blame me…)

And
64bits https://www.dropbox.com/s/hhe0io7mcgcle1c/SendSignalCtrlC64.exe?dl=0
Clean also by Virrustotal today
https://www.virustotal.com/#/file/29711209fed703199c7cc75b402e10708cdaaec9169a0b297167588308b3b58e/detection

That would let you quit rclone using the remote control…

So you’d run rclone as normal but with the --rc flag

rclone mount .... --rc

Then you could run

rclone rc core/quit

to quit rclone which should be enough to unmount the FS.

If you are running batch script simultaneiously then you would need to give each rc a different port with --rc-addr localhost:12345

SignalSend sounds like a reasonable solution if it works for you

1 Like

Thanks, understood.
I will use SignalSend then.
CT

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