Computing.Net > Forums > Programming > Create text file based on user input

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Create text file based on user input

Reply to Message Icon

Name: pcuser12
Date: October 28, 2009 at 21:45:30 Pacific
OS: Windows 7
Subcategory: Batch
Comment:

I would like to make a batch file, which I think
would be easiest, to create a text file named
userinput.cfg.

In userinput.cfg, I want it to create this line:

user_input_key = "whatever they type"

The "whatever they type" I want to be based
on user input, like a prompt to enter the text
which puts it in the quotes.

Also, I would like it to place this file in an
existing directory.

I want it to be (current base directory they're
using (IE: C: or E:))\Program Files or Program
Files(x86)\directory\cfg

So in the end, they have a new file in this
directory with a new line, part of that line being
based on userinput.

Also, because I have no idea of the
complexities of this, I'd like it to add the above
line to the file if it already exist.

I hope this is all clear enough, I'll try to
respond to any questions you have about my
request promptly. I'm a complete novice to
programming and decided this would be an
excellent place to get help. I'm not completely
sure this can be done in Batch, or if it's the
correct choice for my request. Thanks for any
and all help.



Sponsored Link
Ads by Google

Response Number 1
Name: X-TechKid
Date: November 2, 2009 at 23:36:38 Pacific
Reply:

Hi, pcuser12

here's the code buddy..

@echo off
color A
@echo Enter the name of the file which u want to create
set /p n=Console:
Date /t >> %n%.log

It creates user desired file in the same folder..


Keep smiling :-)


0
Reply to Message Icon

Related Posts

See More


Batch fle RANDOM Dynamically Unziping the ...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Create text file based on user input

what programming language to chose www.computing.net/answers/programming/what-programming-language-to-chose/9048.html

Move a XML file based on content www.computing.net/answers/programming/move-a-xml-file-based-on-content/18945.html

Create new dir based on dir names www.computing.net/answers/programming/create-new-dir-based-on-dir-names/19742.html