Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you redirect standard input to a file in the Windows command line?

On Unix I would do something like:

cat > file.txt

How can I do this on the Windows command prompt or batch file?

EDIT: Basically, I am looking for the functionality of cat with no arguments (it reads from stdin and spits it back out to stdout).

like image 513
Matt Avatar asked May 30 '12 20:05

Matt


1 Answers

TYPE CON

CON is the MS-DOS device for console input. You can redirect to a file as follows:

TYPE CON>output.txt

To terminate, hit Ctrl + C or Ctrl + Z, Enter (Ctrl + Z = EOF).

like image 137
Mark K Cowan Avatar answered Sep 23 '22 00:09

Mark K Cowan