1
如果可執行文件正在從DVD ROM中運行,'WaitForExit'將不會等待,但是如果從C:驅動器或外部閃存驅動器運行,它將「等待」。任何線索爲什麼這個屬性不起作用?WaitForExit不會等待exe文件在DVD光盤中
- 我看到任務管理器這個過程
- 我使用VB.NET 2010
這是我的代碼。
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Dim p As New Process
With p
With p.StartInfo
.FileName = "D:\setup.exe" 'DVD DRIVE
'.FileName = "F:\setup.exe" 'EXTERNAL DRIVE
End With
.EnableRaisingEvents = True
.Start()
.WaitForExit()
.Close()
.Dispose()
End With
p = Nothing
MsgBox("END")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
謝謝Hans。 –