run procces从每个循环继续

时间:2018-06-16 05:40:30

标签: visual-studio

我有一些麻烦继续进程。 继续进程从表循环执行每个。 这是我的代码

  For Each Item As String In CheckedListBox3.CheckedItems
        ' MessageBox.Show(Item)

        If CheckedListBox3.CheckedItems.Count <> 0 Then

            Dim x As Integer
            Dim s As String = Item
            For x = 0 To CheckedListBox3.CheckedItems.Count - 1
                s = s & "Checked Item " & (x + 1).ToString & " = " & CheckedListBox3.CheckedItems(x).ToString & ControlChars.CrLf
            Next x


            MyProcess = New Process
            With MyProcess.StartInfo
                .FileName = "7zip"
                .Arguments = " -e " & Item

                .UseShellExecute = False
                .CreateNoWindow = True
                .RedirectStandardInput = True
                .RedirectStandardOutput = True
                .RedirectStandardError = True


            End With
            MyProcess.EnableRaisingEvents = True
            MyProcess.Start()

            MyProcess.BeginErrorReadLine()
            MyProcess.BeginOutputReadLine()
            AddHandler MyProcess.OutputDataReceived, AddressOf proc_OutputDataReceived
            AddHandler MyProcess.ErrorDataReceived, AddressOf proc_OutputDataReceived

但是当我运行代码如果表10行,10进程7zip正在提取文件。 我想要的是,7zip是第一个表文件名中的提取文件,并在第一个文件被完全提取后继续。

当我把myprocess.waitForexit()myprocess.close()放在最后一个代码上时,程序就会挂起而不再继续。 我的代码有任何问题。 程序运行就像我想要的那样, 抱歉,如果我的英语不好

0 个答案:

没有答案