Store variable

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
walter4991
Posts: 21
Joined: 11 Dec 2010 10:17

Store variable

#1 Post by walter4991 » 02 Feb 2011 08:10

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.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Store variable

#2 Post by aGerman » 02 Feb 2011 09:33

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

walter4991
Posts: 21
Joined: 11 Dec 2010 10:17

Re: Store variable

#3 Post by walter4991 » 02 Feb 2011 10:04

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.

Post Reply