Something like a function/method in batch files?

后端 未结 9 449
忘了有多久
忘了有多久 2020-12-08 00:05

is there anything that mimicks a method like one knows it from Java, C# etc.? I have 5 lines of commands in a batch file, those 5 lines are used at more than one place insid

9条回答
  •  生来不讨喜
    2020-12-08 00:31

    Placing the reusable functions into a separate batch file would certainly work to simulate a function.

    The catch is that you have to use the call command in order to ensure that control returns to the caller after the second batch file finishes executing.

    call 5lines.bat
    echo this will now get called
    

提交回复
热议问题