Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to write a batch file that will create a popup window for the user to input some specific information, and place that information into a text file? The text file should already have some text in it but I just want a couple lines to have input from the user. This is what the text file should look like:

PARTSN="USER INPUT1"
PART=blahblah
WORKSTATION=blahblah
USERID="USER INPUT2"
SIZE=blahblah

Where it says "USER INPUT1,2" is where I want the information from the user placed.

Any help would be great!

share|improve this question

2 Answers 2

You can use set /p to ask the user for input:

set /p SomeVar=What is your favourite colour? 
echo Favourite colour: %SomeVar%
share|improve this answer
    
This is exactly what i was looking for. Thank you!! –  John Z Jan 29 '13 at 16:24

This will ask for four values, then print the resulting file to the desktop. It will append to the same file everytime you run this, unless you delete the file.

@echo off
set Output="%USERPROFILE%\desktop"

set /p VarOne=Enter variable one value: 
set /p VarTwo=Enter variable two value: 
set /p VarThree=Enter variable three value: 
set /p VarFour=Enter variable four value: 

REM enter your desired output here
echo Variable One   = %VarOne% >> %Output%\test.txt
echo Variable Two   = %VarTwo% >> %Output%\test.txt
echo Variable Three = %VarThree% >> %Output%\test.txt
echo Variable Four  = %VarFour% >> %Output%\test.txt

echo.
echo File has been placed %Output%
pause
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.