RCLONE.VBS 挂载脚本

2,434次阅读
没有评论

 

Option Explicit
Dim WMIService, Process, Processes, Flag, WS
Set WMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set Processes = WMIService.ExecQuery("select * from win32_process")
Flag = true
for each Process in Processes
    if strcomp(Process.name, "rclone.exe") = 0 then
        Flag = false
        exit for
    end if
next
Set WMIService = nothing
if Flag then
    Set WS = Wscript.CreateObject("Wscript.Shell")
    WS.Run "rclone mount GDrive:/ x: --cache-dir F:\Temp --vfs-cache-mode writes", 0
end if


如果想要挂载多个,请问该如何操作呢?WS.Run“rclone mount GDrive:/ x: –cache-dir F:\Temp –vfs-cache-mode writes”, 0
再添加一行修改 
Option Explicit
Dim WMIService, Process, Processes, Flag, WS , ProcessEnv
Set WMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set Processes = WMIService.ExecQuery("select * from win32_process")
Flag = true
for each Process in Processes
    if strcomp(Process.name, "rclone.exe") = 0 then
        Flag = false
        exit for
    end if
next
Set WMIService = nothing
if Flag then
    Set WS = Wscript.CreateObject("Wscript.Shell")
	Set ProcessEnv = WS.Environment("PROCESS")
	ProcessEnv("https_proxy") = "https://127.0.0.1:1080/"
	ProcessEnv("http_proxy") = "http://127.0.0.1:1080/"
    WS.Run "rclone mount GDrive:/ x: --cache-dir F:\Temp --vfs-cache-mode writes", 0
end if

正文完
 0
评论(没有评论)
验证码