How to set the input of a program in Windows?

Asked

Viewed 79 times

1

A simple question. On *NIX systems, you can do the following:

cat input_do_programa.file
"texto exemplo"
input_do_programa.file > meu_programa.exe

There is an equivalent for Windows?

  • 1

    As far as I know the same thing works: programa.exe < entrada.txt

1 answer

4


The program to be executed must come first. < to redirect the default input stream (stdin) and > to redirect the output stream (stdout) (>> to add to the end of the file). To redirect the default error output (stderr) use 2>:

programa.exe < entrada.txt > saida.txt 2> erro.txt

It is not necessary to redirect both input and output, it can be only one of the two.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.