08.02.2022 Views

batch-file-es Windows

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Capítulo 25: Redirección de entrada y salida.

Sintaxis

• [comando] [[> | >> | <| 2> | 2 >>] archivo]

• [[> | >> | <| 2> | 2 >>] archivo] [comando]

Parámetros

Parámetro

mando

Detalles

Cualquier comando válido.

> Escriba STDOUT en el archivo.

>> Agregue STDOUT al archivo.

< Lea el archivo a STDIN .

2> Escribe STDERR al archivo.

2>> STDERR al archivo.

expediente

La ruta a un archivo.

Observaciones

• Puede agregar tantas redirecciones diferentes como desee, siempre que el símbolo y el

archivo de la redirección permanezcan juntos y en el orden correcto.

Examples

Un ejemplo...

@echo off

setlocal

set /p "_myvar=what is your name?"

echo HELLO!>file.txt

echo %_myvar%!>>file.txt

echo done!

pause

type file.txt

endlocal

exit

Ahora file.txt se ve como:

https://riptutorial.com/es/home 74

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!