input from batch file

I want to create a batch file in which a user would input some info, then I would use their input, and input it to another part of the batch file.
I googled and found something about how you usually have the user input go into a file, then push the info from the file into whatever line you want in the batch file. So far I have

set /p name="Enter your login name: "
%name% > C:\input\loginnames.txt

however, when I run this, it does ask for the name, but the name isn't put into the loginnames.txt
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
Change to.
echo %name% > C:\input\loginnames.txt

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JeffBeallAuthor Commented:
as soon as I saw your solution it made sense! I wouldn't have come up with that on my own though. Just not enough experience making these batch files!
Thank you for the help.
Bill PrewIT / Software Engineering ConsultantCommented:

Keep in mind too that you don't need to save the input into a text file to reference it later in the same BAT file.  The variable can also be used elsewhere in the script once it has been set.

IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Lee W, MVPTechnology and Business Process AdvisorCommented:
If you really need the login name, then that's already in an environment variable.

Just use %username% - it's already there - no set /p username=Enter name; JUST echo %username% > loginnames.txt

Also, as written, that will OVERWRITE every time.  If you want to keep a LOG then you want to use >> to append.

If you want to post EXACTLY what you want to accomplish, it's probably easier to do than you're currently planning.
JeffBeallAuthor Commented:
ok, I have to slow down on awarding points.
I'm sorry Bill Prew and Lee W. I've already closed the question, so I can't give you points. I'll ask another question explaining exactly what I'm trying to do.
Bill PrewIT / Software Engineering ConsultantCommented:
No worries on points, just want to help you get the best solution to your problem.

Please link the new question to this one and we will automatically be notified when you post it.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.