Well Herfried, I'm stuck. Here is my code:
Dim strInput1 As String = (lblMameExePath.Text & " -listinfo
Dim p As New System.Diagnostics.ProcessStartInfo
p.Verb = "print"
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden
p.UseShellExecute = False
p.Arguments = " -listinfo> C:\test.cfg"
p.FileName = "C:\mame\mame.exe"
Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)
System.Diagnostics.Process.Start(p)
pr.WaitForExit()
response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")
I am trying to keep it simple to get it working. The actual commandline is
"C:\Mame\Mame.exe -listinfo> C:\Program Files\CPViewer\MameGames.cfg". In
my
code I want to use Application.StartupPath in place of "C:\Program
Files\CPViewer" but I'll get to that later. I have another post somewhere
and have read others about spaces in paths and the command window not
agreeing. The above code executes without errors but not file is created.
I
am using the following code sucessfully but can't pause it.
Dim strInput As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"
Dim sr As StreamWriter = File.CreateText(strInput)
sr.WriteLine(lblMameExePath.Text & " -listinfo >""" &
Application.StartupPath & "\mamegames.cfg""")
sr.Close()
Dim p As New System.Diagnostics.ProcessStartInfo
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = strInput
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
response = MsgBox("Your file has been created successfully.",
MsgBoxStyle.Information, "CPViewer")
As you can see, I create a batch file containing my command then execute
the
batch file. I then remove the batch file upon exiting the form with this
code:
If File.Exists(Application.StartupPath & "\CreateMameGamesCFG.bat") Then
Dim path3 As String = Application.StartupPath &
"\CreateMameGamesCFG.bat"
Dim fi3 As FileInfo = New FileInfo(path3)
fi3.Delete()
End If
BUT, I can't get the code to pause until the cfg file is created. What am
I
missing here?
Thank you for your help,
John