Page 1 of 1

write user input to output file

Posted: 05 May 2011 07:08
by tcurrier
Hi,

I want to prompt a user for input, then write the results to
a file (say, C:\USERINPUT.TXT, for example)

C:\USERINPUT.TXT:
Joe Smith
000-555-1212

Any suggestions on how to do this?

Thanks for any help.

Current code:

Code: Select all

:input
set INPUT=
set /P INPUT=Type Enter your name please : %=%
if "%INPUT%"=="" goto input
echo Your input was: %INPUT%

:input2
set INPUT2=
set /P INPUT2=Type Enter your phone # : %=%
if "%INPUT2%"=="" goto input2
echo Your input was: %INPUT2%     

Re: write user input to output file

Posted: 05 May 2011 07:56
by !k
>C:\USERINPUT.TXT echo %INPUT%
>>C:\USERINPUT.TXT echo %INPUT2%

Re: write user input to output file

Posted: 05 May 2011 08:13
by tcurrier
Thanks, but I got the following :

'C:\USERINPUT.TXT' is not recognized as an internal or external command,
operable program or batch file.

Re: write user input to output file

Posted: 05 May 2011 08:29
by tcurrier
Just had to rearrange things a little bit ;-)

Code: Select all

echo %INPUT%   >  c:\output_file.txt
echo %INPUT2%  >> c:\output_file.txt


This works ... thanks for your help !

Re: write user input to output file

Posted: 05 May 2011 09:49
by !k
'C:\USERINPUT.TXT' is not recognized as an internal or external command,
operable program or batch file.

You lost arrows

>C:\USERINPUT.TXT echo %INPUT%
>>C:\USERINPUT.TXT echo %INPUT2%