Last active
August 29, 2022 09:56
-
-
Save chriskyfung/b6f01bf4bb19c1f858f9fe74f56f8fe0 to your computer and use it in GitHub Desktop.
VBScript for mounting multiple cloud storages (Box, Dropbox and OneDrive) to Windows OS with Rclone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set colDrives = objFSO.Drives | |
Dim FlagO, FlagP , WS | |
FlagO = true | |
FlagP = true | |
For Each objDrive in colDrives | |
if strcomp(objDrive.DriveLetter, "<Drive Letter #1>") = 0 then | |
FlagO = false | |
Wscript.Echo "Drive <Drive Letter #1> has already been used!" | |
elseif strcomp(objDrive.DriveLetter, "<Drive Letter #2>") = 0 then | |
FlagP = false | |
Wscript.Echo "Drive <Drive Letter #1> has already been used!" | |
end if | |
Next | |
if FlagO then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount <Name of Drive #1>:/ <Drive Letter #1>: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if | |
if FlagP then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount <Name of Drive #1>:/ <Drive Letter #2>: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set colDrives = objFSO.Drives | |
Dim FlagM, FlagN , WS | |
FlagM = true | |
FlagN = true | |
For Each objDrive in colDrives | |
if strcomp(objDrive.DriveLetter, "X") = 0 then | |
FlagM = false | |
Wscript.Echo "Drive X has already been used!" | |
elseif strcomp(objDrive.DriveLetter, "Y") = 0 then | |
FlagN = false | |
Wscript.Echo "Drive Y has already been used!" | |
end if | |
Next | |
if FlagM then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount ""Box Gmail"":/ X: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if | |
if FlagN then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount ""Box Hotmail"":/ Y: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set colDrives = objFSO.Drives | |
Dim FlagR, FlagS, WS | |
FlagR = true | |
FlagS = true | |
For Each objDrive in colDrives | |
if strcomp(objDrive.DriveLetter, "G") = 0 then | |
FlagR = false | |
Wscript.Echo "Drive G has already been used!" | |
elseif strcomp(objDrive.DriveLetter, "H") = 0 then | |
FlagS = false | |
Wscript.Echo "Drive H has already been used!" | |
end if | |
Next | |
if FlagR then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount ""Dropbox Gmail"":/ G: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if | |
if FlagS then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount ""Dropbox Hotmail"":/ H: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objFSO = CreateObject("Scripting.FileSystemObject") | |
Set colDrives = objFSO.Drives | |
Dim FlagO, FlagP , WS | |
FlagO = true | |
FlagP = true | |
For Each objDrive in colDrives | |
if strcomp(objDrive.DriveLetter, "O") = 0 then | |
FlagO = false | |
Wscript.Echo "Drive O has already been used!" | |
elseif strcomp(objDrive.DriveLetter, "P") = 0 then | |
FlagP = false | |
Wscript.Echo "Drive P has already been used!" | |
end if | |
Next | |
if FlagO then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount OneDrive1:/ O: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if | |
if FlagP then | |
Set WS = Wscript.CreateObject("Wscript.Shell") | |
WS.Run "rclone mount OneDrive2:/ P: --cache-dir C:\Temp --vfs-cache-mode writes", 0 | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment