Addressing the user

March 12, 2010 at 07:59:55
Specs: Windows XP
i want to know if there is a way to have your batch file address the user. E.x. have the file prompt the user to type his/her name in then have the file say something along the lines of hello ~insert name here~.


See More: Addressing the user

Report •

March 12, 2010 at 09:37:46
I replied to you in PM
But. I'll answer this. Because there are some different things you can do.

First is getting user input.
Set /p Name=Type your name:
They enter name...

Then you put the code
Echo Hello %Name%.

If the person types "Matt"
The 2nd line of code will say
Hello Matt.

You can also use this variable
This will display the user that you are logged into.
So if your username is "Matt".
%username% will be replaced with the username you're logged into.

Here's some Examples of Code.

Echo Type your name.
Set /p Name=Type:
Echo Welcome %Name%! How are you ?
Pause >nul

And also try this one.
Echo Hello %username%.
Pause >nul

Hope that helps!

Need help? Just ask. :)

Report •
Related Solutions

Ask Question