home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,888 of 68,980   
   Dallas to Tim Rude   
   Re: Call Subroutine from another Subrout   
   29 Jun 22 15:32:19   
   
   From: dallas@texas.usa   
      
   On 6/29/2022 3:10 PM, Tim Rude wrote:   
    > Works for me like this:   
    > @echo off   
    > echo Start of main batch file   
    > call :_One   
    > echo End of main batch file   
    > goto :EOF   
    >   
    > :_One   
    > echo Stuff from :_One   
    > call :_Two   
    > echo Back in :_One again   
    > goto :EOF   
    >   
    > :_Two   
    > echo Stuff from :_Two   
    > call :_Three   
    > echo Back in :_Two again   
    > goto :EOF   
    >   
    > :_Three   
    > echo Stuff from :_Three   
    > goto :EOF   
    >   
    > ---   
    >   
    > Output generated is:   
    >   
    > Start of main batch file   
    > Stuff from :_One   
    > Stuff from :_Two   
    > Stuff from :_Three   
    > Back in :_Two again   
    > Back in :_One again   
    > End of main batch file   
    >   
    > So I nested 3 levels deep and came back out of each level as expected.   
      
      
   I had no idea you could have internal subroutines like that.   
      
   You can even use recursion.   
      
   Thanks for the example!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca