![Avatar of bobbailey22](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
bobbailey22
asked on
Capture return code from Shell App
Experts,
The FTPS (MOVEit Freely Secure FTP) Application that is called in the Shell() below will return an error code (0 if successful). How can I capture the return code that FTPS returns?
Dim ProcID
' Execure Secure FTP
ProcID = Shell("FTPS -e:on -z -s:""C:\HCC_Upload_Files\F tpUploadSc ript.TXT"" sftp.domain.com", AppWinStyle.NormalFocus, True, 120000)
The FTPS (MOVEit Freely Secure FTP) Application that is called in the Shell() below will return an error code (0 if successful). How can I capture the return code that FTPS returns?
Dim ProcID
' Execure Secure FTP
ProcID = Shell("FTPS -e:on -z -s:""C:\HCC_Upload_Files\F
![Avatar of bobbailey22](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
ASKER
Idle_Mind,
I was really excited about your solution (love learning new stuff) but I keep getting the following error when the Process.Start line is executed...
An unhandled exception of type 'System.ComponentModel.Win 32Exceptio n' occurred in system.dll
Additional information: The system cannot find the file specified
I also tried qualifying the executable like so...
p = Process.Start("""C:\Progra m Files\MOVEit\FTPS.exe"" -e:on -z -s:""C:\HCC_Upload_Files\F tpUploadSc ript.TXT"" sftp.hcclife.com")
but got the same error.
I know the text file path and name are good.
Any Ideas????
I was really excited about your solution (love learning new stuff) but I keep getting the following error when the Process.Start line is executed...
An unhandled exception of type 'System.ComponentModel.Win
Additional information: The system cannot find the file specified
I also tried qualifying the executable like so...
p = Process.Start("""C:\Progra
but got the same error.
I know the text file path and name are good.
Any Ideas????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
![Avatar of bobbailey22](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
ASKER
You are awesome! If I could give you an A+++ I would.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim p As Process
p = Process.Start("FTPS -e:on -z -s:""C:\HCC_Upload_Files\F
p.WaitForExit()
Dim exitCode As Integer = p.ExitCode
MsgBox("exitCode = " & exitCode)
End Sub