stopping batch file

Using VB Can we stop a batch file which is running
Scenario
c:\vbtest.bat


contents of vbtest.bat
start c:\myexample.exe
dir

contents of myexample.exe
------
check for username and password
if password is wrong
I should stop that vbtest ie dir should not be executed.Any ideas or questions let me know



Answer this question

stopping batch file

  • Dave Britton - VERTIGO

    I would not do it that way. I would have the VB app

    launch the batch file if everything is okay.

    But your way, possibly:

    ──────────────────────────────── C:\test.bat
    rem Set you exit code In VB
    rem Dim value As Integer
    rem value = Environment.ExitCode
    ren Environment.ExitCode = value
    rem
    rem Run, not start, a VB console app.
    rem The batch file will not wait
    rem on a windows app.
    MyConsoleapp.exe
    if errorlevel 1 goto end
    dir
    :end



  • stopping batch file