Batch file how to call another batch file at a specified label or call and immediately goto a certain label?

前端 未结 5 1434
不知归路
不知归路 2021-01-02 00:57

I am trying to figure out how file1.bat can call file2.bat at a specified label.

I figured I can do it like this:

File1.bat

:config
         


        
5条回答
  •  猫巷女王i
    2021-01-02 02:01

    You could pass the label you want to go to as a parameter

    Example scripts

    First.bat

    @echo off
    set label=GOHERE
    call Second.bat %label%
    pause >nul
    

    Second.bat

    @echo off
    goto %1
    echo This line should be skipped
    :GOHERE
    echo Jumped here
    

提交回复
热议问题