一、下載並安裝 Rclone#
- 從rclone 官網下載你所對應的版本
解壓到你認為合適的位置
- 為 rclone 配置環境變量
- 找到系統下面的系統信息
- 打開環境變量
- 找到 Path 這一欄
- 將你剛剛放 rclone 的文件夾添加進去,例如
D:\rclone
- 打開終端試試環境變量是否生效
二、下載並安裝 WinFsp#
- Windows 系統下還需要安裝 WinFsp,rclone 才能正常使用
WinFsp官网下载,按照指示一路下一步即可
三、配置你的網盤#
接下來需要配置 rclone,在終端輸入以下命令進行配置
rclone config
輸入 n 即可新建配置
e/n/d/r/c/s/q> n
name> onedrive #隨意,要記住待會兒要用
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Digital Ocean, Dreamhost, IBM COS, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Compress a remote
\ (compress)
12 / Dropbox
\ (dropbox)
13 / Encrypt/Decrypt a remote
\ (crypt)
14 / Enterprise File Fabric
\ (filefabric)
15 / FTP Connection
\ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
17 / Google Drive
\ (drive)
18 / Google Photos
\ (google photos)
19 / Hadoop distributed file system
\ (hdfs)
20 / Hubic
\ (hubic)
21 / In memory object storage system.
\ (memory)
22 / Jottacloud
\ (jottacloud)
23 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
24 / Local Disk
\ (local)
25 / Mail.ru Cloud
\ (mailru)
26 / Mega
\ (mega)
27 / Microsoft Azure Blob Storage
\ (azureblob)
28 / Microsoft OneDrive
\ (onedrive)
29 / OpenDrive
\ (opendrive)
30 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
31 / Pcloud
\ (pcloud)
32 / Put.io
\ (putio)
33 / QingCloud Object Storage
\ (qingstor)
34 / SSH/SFTP Connection
\ (sftp)
35 / Sia Decentralized Cloud
\ (sia)
36 / Storj Decentralized Cloud Storage
\ (storj)
37 / Sugarsync
\ (sugarsync)
38 / Transparently chunk/split large files
\ (chunker)
39 / Union merges the contents of several upstream fs
\ (union)
40 / Uptobox
\ (uptobox)
41 / Webdav
\ (webdav)
42 / Yandex Disk
\ (yandex)
43 / Zoho
\ (zoho)
44 / http Connection
\ (http)
45 / premiumize.me
\ (premiumizeme)
46 / seafile
\ (seafile)
Storage> 28 #根據你要掛載的網盤進行選擇
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>#留空
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>#留空
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
1 / Microsoft Cloud Global
\ (global)
2 / Microsoft Cloud for US Government
\ (us)
3 / Microsoft Cloud Germany
\ (de)
4 / Azure and Office 365 operated by 21Vianet in China
\ (cn)
region> 1 #根據自己的情況選擇,不確定就選1
Edit advanced config?
y) Yes
n) No (default)
y/n>
接著就會跳轉瀏覽器進行授權,登錄你的網盤賬號即可
繼續往下
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
\ (url)
4 / Search for a Sharepoint site
\ (search)
5 / Type in driveID (advanced)
\ (driveid)
6 / Type in SiteID (advanced)
\ (siteid)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type> 1
Drive OK?
Found drive "root" of type "business"
URL: https://iginsing-my.sharepoint.com/personal/xxxxxxxx/Documents
y) Yes (default)
n) No
y/n>#回車
--------------------
[onedrive]
type = onedrive
token = {"access_token":xxxxx}
drive_id = xxxxxxxxxx
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>#回車
Current remotes:
Name Type
==== ====
onedrive onedrive
輸入 q,然後回車退出配置
四、掛載網盤到本地#
在終端中輸入
rclone mount onedrive:/ X: --cache-dir F:\OneDrive --vfs-cache-mode writes &
mount 後面第一個參數是你最開始輸入的 name, / 即為掛載網盤的根目錄,可自行更改。第二個參數為你要掛載到本地的路徑,我這裡是掛載到了X盤,--cache-dir
是指定緩存目錄,當你每次想掛載的網盤寫文件時都會先向緩存路徑 copy 一份再慢慢進行上傳,所以要注意緩存路徑的空間大小是否夠用。--vfs-cache-mode
即為 VFS 緩存的模式,更多信息請參考VFS File Caching,&
即為後台運行。
五、編寫開機自啟腳本#
將剛才掛載網盤的命令複製到一個空白文本文件裡,將文本文件擴展名改為 bat
rclone mount onedrive:/ X: --cache-dir F:\OneDrive --vfs-cache-mode writes &
再新建一個文本文件輸入以下命令,將擴展名改為 vbs,並將其放入C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
中,開機就會執行此腳本,實現開機掛載網盤到本地X
盤
CreateObject("WScript.Shell").Run "cmd /c D:/rclone.bat",0
其中D:/rclone.bat
即為上面創建的 bat 文件路徑,請根據自身情況更改。