Tuesday 15 January 2013

How to make a batch program stop Midway -



How to make a batch program stop Midway -

i'm making batch programme want stop midway. want execute other commands when called :command. there way can this? not looking pause, want not play other commands below. want stop code in tracks. doesn't play commands until called. illustration below:

@echo off :talk echo dont part until called :noname echo going talk goto :talk

the normal way exit or goto :eof. goto helpful:

using goto :eof(means: "go end of script"):

set /p "x=enter command: " if /i "%x%"="talk" phone call talk goto :eof echo line never reached :talk echo going talk goto :eof :listen echo listening part goto :eof

using exit:

set /p "x=enter command: " if /i "%x%"="talk" phone call talk exit /b echo line never reached :talk echo going talk goto :eof

using goto:

:input set /p "x=enter command: " if /i "%x%"="talk" phone call talk goto :input echo line never reached :talk echo going talk goto :eof

in other words: end each of called "subroutines" goto :eof

batch-file

No comments:

Post a Comment