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.

cls

echo Please input the file path, surrounded by "double quotation marks" if necessary.

REM If you don't want to redirect, escape the > by preceding it with ^

set /p filepath=^>

echo Writing a random number

echo %RANDOM% > %filepath%

echo Reading the random number

type %filepath%

REM Successive file writes will overwrite the previous file contents

echo Writing the current directory tree:

> %filepath% tree /A

echo Reading the file

type %filepath%

REM nul is a special file. It is always empty, no matter what you write to it.

echo Writing to nul

type %windir%\win.ini > nul

echo Reading from nul

type nul

echo Writing nul's contents to the file

type nul > %filepath%

echo Reading the file

type %filepath%

Lea Redirección de entrada y salida. en línea: https://riptutorial.com/es/batchfile/topic/7502/redireccion-de-entrada-y-salida-

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

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

Saved successfully!

Ooh no, something went wrong!