0

So I'm trying to make it so that the user sets a password, and that password is loaded into a text file to be extracted for later use. The problem is, instead of typing the variable that the user inputs in the text file, it types 'ECHO is off' (or ECHO is on, if it's on).

Here is what I have written.

cls
set/p pass = Please enter your password:
> "p.txt" (@echo %pass%)
echo Password created!

Thanks in advance!

EDIT: Thanks to MC ND, I have the solution! set /p "pass= Please enter your password:"

3
  • tip: highlight code and hit ctrl-K or click the {} button to turn it into a code block. manual workaround: indent each line with 4 spaces. Commented Sep 24, 2014 at 17:00
  • Marc B - Yeah, figured it out when I updated it. Thanks. Commented Sep 24, 2014 at 17:03
  • You don't need to update your question with the answer, because the accepted answer is clearly visible. Commented Sep 24, 2014 at 17:52

1 Answer 1

1

Spaces

set/p pass = Please enter your password:
          ^ This space is included in the name of the variable

So, your variable is named %pass %. Change to

set /p "pass= Please enter your password:"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.