Batch file include external file for variables

后端 未结 9 1073
遥遥无期
遥遥无期 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 09:07

    So you just have to do this right?:

    @echo off
    echo text shizzle
    echo.
    echo pause^>nul (press enter)
    pause>nul
    
    REM writing to file
    (
    echo XD
    echo LOL
    )>settings.cdb
    cls
    
    REM setting the variables out of the file
    (
    set /p input=
    set /p input2=
    )nul
    
    if %input%==XD goto newecho
    DEL settings.cdb
    exit
    
    :newecho
    cls
    echo If you can see this, good job!
    DEL settings.cdb
    pause>nul
    exit
    

提交回复
热议问题