Save the value of a variable on the outside and then import it in Batch

Asked

Viewed 597 times

0

If I create a variable like this:

set /a EXEMPLO=1

"EXAMPLE" is worth 1, can I save this information to the outside environment (in a file) and then import this value back to the same command? So, after closing the command prompt, I can "read" the value EXAMPLE had before.

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%

Browser other questions tagged

You are not signed in. Login or sign up in order to post.