Executing Process from VB Application
-
Hi all: I want to execute .exe(process) when some events is fired from my application. I was able to execute my process by using my following code.
Dim program As New Process program.StartInfo.FileName = "SH_EVP2.exe" program.Start()
My Problem is I need to pass filename as paramters to .exe (process)when I execute it. can you advise me how shall I do this? -
Hi all: I want to execute .exe(process) when some events is fired from my application. I was able to execute my process by using my following code.
Dim program As New Process program.StartInfo.FileName = "SH_EVP2.exe" program.Start()
My Problem is I need to pass filename as paramters to .exe (process)when I execute it. can you advise me how shall I do this?Process.Start("SH_EVP2.exe " + yourParamString) will do it.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Process.Start("SH_EVP2.exe " + yourParamString) will do it.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hey: I did the exactly same that you have provided above. Unfortunately, I got some execptional handling error. Then, later I tried:
Process.Start("SH_EVP2.exe ", "input1.sa")
But still it is not taking input1.sa as a file parameter. Help please.hsprasain wrote:
Unfortunately, I got some execptional handling error.
Christian's code should do the trick, what is the exception you were getting?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
-
hsprasain wrote:
Unfortunately, I got some execptional handling error.
Christian's code should do the trick, what is the exception you were getting?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
The exact code that I wrote as per Christian's suggestion is:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
The exception that I got while executing the application is: The system can't find the file specified. However I have input1.sa in the bin directory. I felt "SH_EVP2.exe" + yourParamString string got concanated and come up with new file name. Thus I'try the other one that I've posted above. Thanks for your help -
The exact code that I wrote as per Christian's suggestion is:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
The exception that I got while executing the application is: The system can't find the file specified. However I have input1.sa in the bin directory. I felt "SH_EVP2.exe" + yourParamString string got concanated and come up with new file name. Thus I'try the other one that I've posted above. Thanks for your helpYou might have to specify the file path to the parameter file as well...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
-
You might have to specify the file path to the parameter file as well...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
-
The exact code that I wrote as per Christian's suggestion is:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
The exception that I got while executing the application is: The system can't find the file specified. However I have input1.sa in the bin directory. I felt "SH_EVP2.exe" + yourParamString string got concanated and come up with new file name. Thus I'try the other one that I've posted above. Thanks for your helphsprasain wrote:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
You might be needing a space between the .exe and input1.sa By the looks of your code, it is looking for: SH_EVP2.exeinput1.sa Have you tried:
Process.Start("SH_EVP2.exe " + yourParamString)
, note the space between the last 'e' in exe and the last double quote...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
-
hsprasain wrote:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
You might be needing a space between the .exe and input1.sa By the looks of your code, it is looking for: SH_EVP2.exeinput1.sa Have you tried:
Process.Start("SH_EVP2.exe " + yourParamString)
, note the space between the last 'e' in exe and the last double quote...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
-
The exact code that I wrote as per Christian's suggestion is:
Dim yourParamString As String = "input1.sa" Process.Start("SH_EVP2.exe" + yourParamString)
The exception that I got while executing the application is: The system can't find the file specified. However I have input1.sa in the bin directory. I felt "SH_EVP2.exe" + yourParamString string got concanated and come up with new file name. Thus I'try the other one that I've posted above. Thanks for your helphsprasain wrote:
The system can't find the file specified.
Of course not, you're trying to start SH_EVP2.exeinput1.sa, which does not exist.
hsprasain wrote:
I felt "SH_EVP2.exe" + yourParamString string got concanated and come up with new file name.
Yeah, I thought it was obvious you needed a space.
hsprasain wrote:
However I have input1.sa in the bin directory.
Doesn't really matter. sh_evp2.exe needs to be in the same folder, or in the general lookup path for windows. Additionally, where-ever sh_evp2.exe is, *it* needs to be able to find input1.sa, that is, even if sh_Evp2.exe starts from anotehr folder, odds are very low it will be able to find input1.sa. Application.ExecutablePath ( from memory ) contains the path to your exe, use Path.Combine to create the full path to input1.sa, make sure that sh_evp2.exe is able to be found, put in a space, and it should work.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )