vb.net の Async BackgroundWorker プロセスでコマンド ライン ユーティリティを実行するにはどうすればよいですか?
例:
Private Sub UpgradeButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpgradeButton.Click
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim MyWorkingDirectory = "C:\Windows\System32\"
Dim MyFileName As String = "notepad.exe"
Dim MyArguments As String = ""
Dim myProcess As System.Diagnostics.Process = New System.Diagnostics.Process()
myProcess.StartInfo.WorkingDirectory = MyWorkingDirectory
myProcess.StartInfo.FileName = MyFileName
myProcess.StartInfo.Arguments = MyArguments
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
myProcess.Start()
' Wait until it ends.
myProcess.WaitForExit()
' Close the process to free resources.
myProcess.Close()
End Sub