Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Team,

Batch File:
@echo off
cls
TestApplication.exe

Print value: 
0,1,2,3,....,10.

Pause

VB.Net Application:
Project Name: TestApplication
Module Module1
    Sub Main()
        For index = 0 To 10
            //send index value to batch file
            //How to do that...
        Next
    End Sub
End Module


Give the solution,
How to return values to the batch file and print it in prompt itself.

Thanks in Advance.
Posted
Updated 18-Aug-14 1:22am
v2

You can't: you can only return a single integer value from your application to the calling environment.

If you want to return anything more complex, then I would suggest you pass a file name and path into you application via the command line, write the file with your app, and then print the result from the file in your batch file.
 
Share this answer
 
There is no straight forward way to return value in loop from an application If this is what you are trying to do. What you can do is you can return one value to batch file like given in the below example and receive it in %ERRORLEVEL% variable in the batch file. Hoping this would help.

Public Function Main(ByVal Args() As String) As Integer
For index = 1 To 10
//Do something
Next
Return 1
End Function


Batch file
TestApplication.exe
echo %ERRORLEVEL%
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900