Results 1 to 15 of 15

Thread: [RESOLVED]How to make a command line wait?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Posts
    85

    [RESOLVED]How to make a command line wait?

    In using the code I created below, I have came across an error
    The process cannot access the file because it is being used by another process.
    So my VB 8.0 2005 code is this...
    Private Sub Backup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Backup.Click
    On Error GoTo ClickErr
    Dim fileExists As Boolean
    fileExists = My.Computer.FileSystem.FileExists("C:\Program Files\Store2Office\DBBackup.zip")
    If fileExists Then
    My.Computer.FileSystem.RenameFile("C:\Program Files\Store2Office\DBBackup.zip", "OMC_Backup_DBBackup.zip")
    End If
    Shell("C:\Program Files\Store2Office\HK_Office.exe /backupdb")
    My.Computer.FileSystem.CreateDirectory("C:\Program Files\Store2Office\Archive")


    Dim folderExists As Boolean
    folderExists = My.Computer.FileSystem.DirectoryExists("C:\Program Files\Store2Office\Archive")
    If folderExists Then
    My.Computer.FileSystem.MoveFile("C:\Program Files\Store2Office\DBBackup.zip", "C:\Program Files\Store2Office\Archive\DBBackup.zip")
    End If
    MsgBox("Databases are backed up")
    ClickErr:
    MsgBox(Err.Description)
    End Sub
    So what I am thinking is that the HK_Office.exe is taking a little while to zip up the files for me. So my question is this. How can I make the next line to wait til that process is done before going to the next line to finish my request of moving the files?
    Last edited by davis2533; Aug 6th, 2006 at 08:00 PM. Reason: [RESOLVED]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width