GCaron
asked on
process.start results in "The system cannot find the file specified"
When trying to run the following code I get the "The system cannot find the file specified" error. I have tried a WorkingDirectory of just "d:\cli" after creating the directory and copying the addobj.exe file there as well but get the same error.
Public Function installNewDomain(ByVal xmlString As String) As String
Dim instProc As Process = New Process
Dim argString = " -t org -s " + """ + xmlString + """ + " -u username -p password"
instProc.StartInfo.FileNam e = "addobj.exe"
instProc.StartInfo.Working Directory = "d:\progra~1\Ensim\WEBppl~ 1\cli\"
instProc.StartInfo.Argumen ts = argString
Try
instProc.Start()
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function
I've tried variations of shell as well but get the error "file not found"
Public Function shellNewDomain(ByVal xmlString As String) As String
Dim argString = " -t org -s " + xmlString + " -u username -p password"
Dim appPath As String = "d:\progra~1\Ensim\WEBppl~ 1\cli\addo bj.exe"
Dim shellCall As String = appPath + argString
Dim ProcID As Integer
Try
ProcID = Shell(shellCall, AppWinStyle.Hide, True, 10000)
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function
I know the path is correct, I can cut and paste the path into the run box and the exe executes.
Any thoughts?
Regards,
Greg
Public Function installNewDomain(ByVal xmlString As String) As String
Dim instProc As Process = New Process
Dim argString = " -t org -s " + """ + xmlString + """ + " -u username -p password"
instProc.StartInfo.FileNam
instProc.StartInfo.Working
instProc.StartInfo.Argumen
Try
instProc.Start()
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function
I've tried variations of shell as well but get the error "file not found"
Public Function shellNewDomain(ByVal xmlString As String) As String
Dim argString = " -t org -s " + xmlString + " -u username -p password"
Dim appPath As String = "d:\progra~1\Ensim\WEBppl~
Dim shellCall As String = appPath + argString
Dim ProcID As Integer
Try
ProcID = Shell(shellCall, AppWinStyle.Hide, True, 10000)
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function
I know the path is correct, I can cut and paste the path into the run box and the exe executes.
Any thoughts?
Regards,
Greg
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Also, I just tried copying the cli directory and exe file to c:\ and used c:\cli\addobj.exe with the same results.
If it matters, this is on a Windows 2003 server.
If it matters, this is on a Windows 2003 server.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still having an issue with the code on my 2003 server but have tested the final code on windows 2000 and it works as expected. As I have incorporated parts of both answers I have split the points.
Thank you both for you time and assistance.
Thank you both for you time and assistance.
ASKER
I've now updated to;
Public Function shellNewDomain(ByVal xmlString As String) As String
Dim argString = " -t org -s " + xmlString + " -u username -p password"
Dim appPath As String = "d:\Program Files\Ensim\WEBppliance\cl
Dim shellCall As String = appPath + argString
Dim ProcID As Integer
Try
ProcID = Shell(shellCall, AppWinStyle.Hide, True, 10000)
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
End Function
Public Function installNewDomain(ByVal xmlString As String) As String
Dim instProc As Process = New Process
Dim argString = " -t org -s " + """ + xmlString + """ + " -u username -p password"
instProc.StartInfo.FileNam
instProc.StartInfo.Working
instProc.StartInfo.Argumen
Try
instProc.Start()
Catch ex As Exception
Return ex.Message
End Try
Return "Success"
and receive the same results of "The system cannot find the file specified" and "file not found".
Any other ideas?