English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need the user to enter exactly ONE line into my batch program, hit enter, and have the batch file do something with it. However, i don't know any methods to do this. I already tried copy con (changing enter to ctrl+z using an ansi bomb) but it didn't work. Are there any other things I can try?

2007-07-25 04:33:44 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

I need one _line_ of input. If I need one character, I have choice.com installed already.

2007-07-25 05:54:30 · update #1

I found a solution: The set /P command. Please do not answer this question unless you know you have something better than set /P.

2007-07-25 06:07:07 · update #2

2 answers

"set /p" is a good solution.

Here's another way, using basically one commandline (surrounded by extra formatting stuff)
======================

@echo off
cls
echo Enter your input and hit ENTER
echo Finish by hitting Ctrl-Z, then Enter again.
echo.

:: input command line
for /f "tokens=*" %%i in ('TYPE CON') do set input=%%i
:: check
echo You entered: "%input%"

2007-07-29 09:10:23 · answer #1 · answered by Kevin 7 · 5 0

http://support.microsoft.com/kb/77457

2007-07-25 04:38:01 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers