Срочно помогите с Vbs!!!

Discussion in 'PHP' started by Glynec, 3 Mar 2008.

  1. Glynec

    Glynec Elder - Старейшина

    Joined:
    30 Jan 2008
    Messages:
    68
    Likes Received:
    25
    Reputations:
    2
    Кароч вот такая проблема.Есть код:

    On Error Resume Next
    Set FSO = CreateObject("Scripting.FileSystemObject")
    colDrives = Split("D E F G H I J K L M N O P Q R S T U V W X Y Z")
    Set dictDrives = CreateObject("Scripting.Dictionary")
    For Each Drive In colDrives
    Set Drv = FSO.GetDrive(Drive & ":")
    If Err.Number Then
    dictDrives.Add Drive & ":", False
    Else
    If Drv.DriveType = 1 And Drv.IsReady Then
    dictDrives.Add Drive & ":", True
    Else
    dictDrives.Add Drive & ":", False
    End If
    End If
    Err.Clear
    Next
    ' Бесконечный цикл
    While True
    For Each Drive In dictDrives.Keys
    Set Drv = FSO.GetDrive(Drive)
    If (Err.Number) Or (Drv.IsReady = False) Or (Drv.DriveType <> 1) Then
    Flag = False
    Else
    Flag = True
    End If
    Err.Clear
    Current = dictDrives.Item(Drive)
    If Current <> Flag Then
    If Current = False And Flag = True Then
    Set FSO=CreateObject("Scripting.FileSystemObject")
    FSO.CopyFile "C:\1.txt","???:\Копия 1.txt"

    End If
    dictDrives.Item(Drive) = Flag
    End If
    Next
    WScript.Sleep 1000
    Wend


    Если в кратце то он при запуски ждет подключения флэшки и если она найдена то запускает код выделенный красным.Как видно он копирует файл 1.txt с диска C на флэшку.Что надо вписать вместо ??? чтобы файл копировался именно на додключенную флэшку (за букву флэшки отвечает параметр (Drive).Оч прошу помоч и разобраться.
     
    1 person likes this.
  2. Pashkela

    Pashkela Динозавр

    Joined:
    10 Jan 2008
    Messages:
    2,750
    Likes Received:
    1,044
    Reputations:
    339
    Лень думать, попробуй так:

    FSO.CopyFile "C:\1.txt", Drv & ":\Копия 1.txt"