Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have an file which may be empy , I try to read the file and when the file is empty it says "Echo is off" . Y does this happen ? and can we get a space or null out of this so that it would be easy fr me to compare'

Hi.
> I have an file which may be empy , I try to read the file
How do you read it?
> and when the file is empty it says "Echo is off" .
It's not the empty file that says that. It's the echo command.
> Y does this happen ?
I presume that you read each line of the file (or maybe just the first line) into a variable, and then you echo it like this:
echo %line%
If line is not defined (or if it is defined to be one or more spaces or tabs) then the above command is seen as just this:
echo
And the echo command on its own just tells you whether you have echo set to on or off. To fix this, use:
if defined line echo.%line%
So, if line is undefined, nothing happens. If line is just spaces/tabs, it prints a blank line. If it contains printable characters, it prints them. The dot (.) after echo is treated as a delimiter and not printed.
> and can we get a space or null out of this so that it would be easy fr me to compare'
Sorry, can you rephrase. Space or null out of what? Compare with what?

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |