Page 1 of 1

Store variable

Posted: 02 Feb 2011 08:10
by walter4991
How can I store the value of a variable that can be used to initiate the next batch?

For example: I store a password in the batch then the next time you want in that variable there is my password ...

How can I do?

Thanks, Walter.

Re: Store variable

Posted: 02 Feb 2011 09:33
by aGerman
LOL, sorry but passwords and batch ... the same like fire and water :lol:
Remember, all things are in plain text. Everybody can read it!

OK, to answer your question, here the principles.
Write a single line into a file:

Code: Select all

set /p "passWrite=Enter your password: "
>"pass.txt" echo(%passWrite%


Read the first line of a file:

Code: Select all

set /p "passRead="<"pass.txt"
echo(%passRead%


Regards
aGerman

Re: Store variable

Posted: 02 Feb 2011 10:04
by walter4991
yes yes I know it does not make sense to put a password in a batch ... just what I need for one small thing... :oops: :P
anyway thanks a lot, always accurate ... :D

Regards, Walter.