Batch file include external file for variables

后端 未结 9 1063
遥遥无期
遥遥无期 2020-12-04 08:20

I have a batch file and I want to include an external file containing some variables (say configuration variables). Is it possible?

9条回答
  •  情歌与酒
    2020-12-04 08:55

    If the external configuration file is also valid batch file, you can just use:

    call externalconfig.bat
    

    inside your script. Try creating following a.bat:

    @echo off
    call b.bat
    echo %MYVAR%
    

    and b.bat:

    set MYVAR=test
    

    Running a.bat should generate output:

    test
    

提交回复
热议问题