Hi, I am trying to supply Tecplot with an input file from within my VB.NET code. However, I am finding that I can run Tecplot just fine through MyProcess but, when I am trying to set the MyProcess.Startinfo.Arguments variable it does not work because of the blanks in the path.
Private Sub btnPlotResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlotResults.Click
Dim MyProcess As New System.Diagnostics.Process
MyProcess.StartInfo.CreateNoWindow = True
MyProcess.StartInfo.UseShellExecute = True
'MyProcess.StartInfo.WorkingDirectory = "C:\Documents and Settings\"
MyProcess.StartInfo.FileName = "C:\Program Files\TEC100\Bin\tecplot.exe"
MyProcess.StartInfo.Arguments = strFilename_Tecplot '"C:\Documents and Settings\data.dat"
MyProcess.Start()
So, the problem is that in my string strFilename_Tecplot the whole path of the file I am interested in reading is stored. And this path contains a space as it is "C:\Documents and Settings\data.dat". Tecplot is trying to open up "C:\Documents ". However, if I specify the whole path within quotation marks (as I have commented out above), it works just fine.
Maybe the best way to do this would be to be able to extract just the file name from my string variable strFilename_Tecplot. Is there an easy way to do this? strFilename_Tecplot is set through the save file dialog box:
strFilename = SaveFileDialog1.FileName
strFilename_Tecplot = strFilename
Thanks!
Private Sub btnPlotResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlotResults.Click
Dim MyProcess As New System.Diagnostics.Process
MyProcess.StartInfo.CreateNoWindow = True
MyProcess.StartInfo.UseShellExecute = True
'MyProcess.StartInfo.WorkingDirectory = "C:\Documents and Settings\"
MyProcess.StartInfo.FileName = "C:\Program Files\TEC100\Bin\tecplot.exe"
MyProcess.StartInfo.Arguments = strFilename_Tecplot '"C:\Documents and Settings\data.dat"
MyProcess.Start()
So, the problem is that in my string strFilename_Tecplot the whole path of the file I am interested in reading is stored. And this path contains a space as it is "C:\Documents and Settings\data.dat". Tecplot is trying to open up "C:\Documents ". However, if I specify the whole path within quotation marks (as I have commented out above), it works just fine.
Maybe the best way to do this would be to be able to extract just the file name from my string variable strFilename_Tecplot. Is there an easy way to do this? strFilename_Tecplot is set through the save file dialog box:
strFilename = SaveFileDialog1.FileName
strFilename_Tecplot = strFilename
Thanks!