Save the value of a variable abroad and then import it into Batch

0

If I create a variable like this:

set /a EXEMPLO=1

"EXAMPLE" is 1, how can I save this information on the outside (in a file) and then import that value again into the same command? So, after closing the command prompt, I can "read" the value that EXAMPLE had before.

    
asked by anonymous 09.12.2017 / 19:07

1 answer

1

Yes it is possible, just do so to save:

set /a EXEMPLO=1
>arquivo.txt echo %EXEMPLO%

And to read in another .bat do this:

set /p OUTRA_VARIAVEL=<arquivo.txt

echo %OUTRA_VARIAVEL%
    
09.12.2017 / 19:27