Reputation: 123
So I have a script that works, but at the end of the script I would like to record the date, time, %username%, and ask for a name (that will be typed by the user)
This would all go into a "log" file.
What I have is:
echo Data Secured by %username% On %date% At %time% >> testfile.txt
This works fine. But this is not asking for user input such as a name. I would like it to go like this:
-script will ask for "helper name?:" and will allow ANY THING to be typed here. It will then be inserted with the echo above to read:
echo Data Secured by %username% & %helpername% On %date% At %time% >> testfile.txt
The result in the "log" file would be like this:
Data Secured by John & Jason on Fri 03/08/2013 At 15:29:27.19
The helper name can be anything.
I thought I would use something like
set /p helpername=" ? "
But this seems to be for YES NO answers or answers you can list, a persons name will change.
I hope this all makes sense....can someone please help.
Thank you!
Upvotes: 1
Views: 118
Reputation: 20179
You can use this to get the helper's name:
SET /P HelperName=Enter Helper Name:
And then this to save the data to the file:
ECHO Data Secured by %username% ^& %helpername% On %date% At %time%>>testfile.txt
Upvotes: 1