how to get return value of exe?

chidambaram

Well-known member
Joined
Dec 27, 2007
Messages
62
Location
Chennai,India
Programming Experience
Beginner
hi,

I am working in Microsoft Visual Studio 2003.

I want to execute file using command line argument.

Actually my requirement is run the vb.net exe file in PHP. In Php exe is running using the exec command.

In my exe file i copy a file from one folder to another folder. I have to return whether that file is copied successfully or not to php.

how can i send this information to php from vb.net.

My code is

Dim sourcepath, source, filename As String
Dim destinationpath As String
Dim processvalue As Integer
Dim i As Integer = 0
Try
For Each arg As String In Environment.GetCommandLineArgs()
If i = 0 Then
i = 1
ElseIf i = 1 Then
sourcepath = arg.ToString()
i = 2
ElseIf i = 2 Then
destinationpath = arg.ToString()
i = 3
End If
Next arg
Catch ex1 As Exception
End
End Try

Try
source = sourcepath.Substring(0, sourcepath.LastIndexOf("\"))

filename = sourcepath.Substring(sourcepath.LastIndexOf("\") + 1, sourcepath.Length - sourcepath.LastIndexOf("\") - 1)

Dim destinationfilename = destinationpath & "\" & filename

File.Copy(sourcepath, destinationfilename)

End
Catch ex As Exception

End
End Try

I call this program as

C:\watch\movefolder\movefolder\bin\movefolder.exe \\172.16.3.203\transfer\revathi\Rengaraj.txt \\172.16.3.209\macdata03\DEVELOPER\03Software\developer\Revathi

how can i send copied successfully information to php

Thanks in advance...
 
Last edited:
Use Environment.ExitCode Property or return an integer from Sub Main.
 
Back
Top