Rob van der Woude's Scripting Pages

READLINE

READLINE is one of the internal commands of OS/2 Warp 4's COMMAND.COM.

I haven't tested its presence in older DOS versions yet, but it is unknown in MS-DOS 6.22, PC-DOS 7, and MS-DOS 7.* (Windows 9*) and Windows NT.
Too bad, it did look quite promising.

The command READLINE /? displays the following help text:

Use the READLINE command to read a line of text from the
keyboard and place it in the batch file variables to
This command can only be used from within a batch file.

SYNTAX: READLINE [/V]

where:
  /V    converts the input line to upper case.

I haven't been able to "place it in the batch file variables" yet. At least, not without redirection to temporary files and abuse of the DATE or TIME command (both language dependent).

One use I found, besides reading user input, is to extract only the first line from standard output.
The command:

TYPE filename.txt | READLINE /V

will display only the first line from filename.txt, in uppercase (/V).

 

Use this Rexx version of READLINE in OS/2 CMD.EXE sessions.

Click to view source Click to download the ZIPped sources

 

In Windows 2000 and later, use SET /P to prompt for (a) word(s) or a line of text, or FOR /F to read some words or a line from a text file or from another command's screen output.
Or use my own ReadLine.bat or ReadLine.exe for redirected input (the executable has more command line options).


page last modified: 2014-10-22; loaded in 0.0021 seconds