| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Echo Command The echo command takes a text string as a parameter, and writes (echos) it straight back to the screen. At first glance, this may seem a useless command, which is true when working directly with the CDI. When writing batch files (files containing multiple commands) however, it is the only way to display a progress update on screen as the batch file is processed. One trick that always puzzles new users of this command is the syntax to produce a blank line. Typing the echo command without any parameters may sound like the correct way to do this, but in fact suffixing echo with a full stop (echo.) is the only way to produce a blank line.
The cryptic Echo is on reply to the first command actually has little to do with the echo command, and more to do with batch files. Batch files are discussed later in this chapter, however to prevent a batch file from printing each command to the screen before executing it, type @echo off as the first command in the file. Echo has one further use, in a technique known as piping. It is possible to pipe the output of echo to a file, device or even as input to a program. Using the > symbol followed by a filename after an echo statement will allow you to pipe the output of the echo into the filename specified. For example, typing echo test > out.txt into the CDI will create a file named out.txt, with the word test inside. Almost all CDI commands allow for piping, which can be exceptionally useful when tracking changes. The classic use of piping is with the dir command if you need a directory listing of every file and folder on the hard drive saved to a file, do not purchase third party tools to do it. Simply type dir c: /s > dirlist.txt (the /s parameter tells the dir command to iterate through all sub directories) at the CDI prompt, and the job is done!
Home - Table Of Contents - Contact Us CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com Version 1.0 - Version Date: March 29, 2005 Adapted with permission from a work created by Tcat Houser et al. CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||