# Solved: Check if registry entry is NUL



## scrfix (May 3, 2009)

Correct me if I am wrong but isn't this pretty straight forward?

I am having an issue with the error level not being returned correctly so I must be doing something wrong.

I first check to see if my registry entry exists

```
:_VALUECHECK
:: Check if the registry key exists.
REG QUERY "HKLM\Software\SCR" /v "UserID"
Echo ErrorLevel=%ErrorLevel%
pause
IF %ErrorLevel%==1 GOTO _CREATEREGKEY
IF %ErrorLevel%==0 GOTO _CHECKREGVALUE
 
:_CREATEREGKEY
:: Blah Blah Blah Create Key
 
 
_CHECKREGKEYVALUE
:: Check if the registry key is Nul.
REG QUERY "HKLM\Software\SCR" /v "UserID" > nul
Echo ErrorLevel=%ErrorLevel%
pause
IF %ErrorLevel%==1 GOTO _CREATEREGKEY
IF %ErrorLevel%==0 GOTO _CHECKREGVALUE
```
The bottom part of the above code should return error level 0 because UserID is in fact empty and it does indeed return Error Level 0 however I use the same code a little further down checking a different registry entry that I know for a fact is not empty and it still returns ErrorLevel 0 and goes to the wrong place.

So no matter what the result whether the registry entry is null or not it still returns a errorlevel 0.

Am I missing something?


----------



## scrfix (May 3, 2009)

I believe I have this figured out.
I could nto find an effecient way or any way for that matter to check to see if the registry entry was nul.

So, I store the registry entry into a variable and check if that is nul.

Here is the suedo code.


```
For /F "Tokens=2*" %%a In ('Reg query "Reg Key" /v "Key Value"') Do set _variable=%%b
IF (%_variable%)==() GOTO _SOMEWHERE
IF NOT (%_variable%)==() GOTO _SOMEWHEREELSE
::
::
::
```
*One questions*
1. Is there a better way?


----------



## Squashman (Apr 4, 2003)

You have to check the errorlevel right after any command. After the Regquery you did an echo and pause. If those commands completed successfully the errorlevel will be Zero!
Errorlevel zero is true! Meaning the last commmand completed successfully!


----------



## scrfix (May 3, 2009)

Sorry, that was just for debugging however thank you for letting me know that.

It still failed even without that in there. However I believe that my second way worked. I have it working. Was just wondering if I am doing that correctly or if there is a better way. I think it is pretty simple however when I echo the command within the FOR statement, it echoes 3 times.

I tried to put a GOTO in there to get it out of the FOR loop and it freaked out. Currently working with tech support with someone on a different issue however. Will have to get back to it when I come back from work tonight.


----------



## Squashman (Apr 4, 2003)

Could you just post your full code!


----------



## scrfix (May 3, 2009)

I cannot right now. I would have however that is on another computer at the other office. I do not have it here with me.

I can recreate it if you would like.


```
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
set _variable=%%b
echo %_variable%
GOTO _CHECKVAR
)
 
:_CHECKVAR
IF (%_variable%)==() GOTO _SOMEWHERE
IF NOT (%_variable%)==() GOTO _SOMEWHEREELSE
::
::
```
Off of memory, it was pretty much the above code. 
That echo statement returns 3 times.
It freaked out with the GOTO however setting it like I had above, it worked I was merely attempting to do it within a FOR statement.


----------



## TheOutcaste (Aug 8, 2007)

A Req Query for a value that exists will always return an errorlevel of 0. The fact that it has a null value is not an error; reg query displays the value name, its type, and it's value, whether that is null or actually is defined.
Remember you must use DelayedExpansion inside a For loop. This code will display the value of _variable _before_ the For loop is executed, not the result of the *Set _variable=%%b* statement:

```
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
set _variable=%%b
echo [COLOR=Red]%_variable%[/COLOR]
GOTO _CHECKVAR
)
```
The value is displayed on the 5th line of the Reg Query output, so you can use skip to just get the value and not have to wade through the headers. You need to make sure your variable is undefined first, then use the *If Defined* statement to see if it's null.

```
Set _Variable=
For /F "Tokens=3 skip=4" %%I In ('Reg query "%_RegKey%" /v "%_ValueName%"') Do Set _Variable=%%I
If Defined _Variable (Goto _HasValue) Else (Goto _IsNull)
```


----------



## Squashman (Apr 4, 2003)

```
@echo off & setlocal enableextensions enabledelayedexpansion
For /F "skip=4 Tokens=2*" %%a In ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "system"') Do (
	set _var=%%b
	echo !_var!
	IF "!_var!"=="" (
	echo.Key is blank
	) else (
	echo.Key is not blank
	)
)
```


----------



## scrfix (May 3, 2009)

Jerry,

I attempted your code and I keep getting to the wrong place. It keeps returning R as the variable when it is null. I believe that is because of my registry name.

I have attempted various combinations with the tokens and the skips.

*Code being utilized*

```
For /F "Tokens=3 skip=4" %%I In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do Set _variable=%%I
echo %_variable%
If Defined _variable (Goto _VARDEFINED) Else (Goto _VARNOTDEFINED)
```
*Updated*
I attempted squashmans code however it skipped right past everything. I did have to remove the @echo off& and just keep the setlocal statement.

*Code Utilized*

```
setlocal enableextensions enabledelayedexpansion
For /F "skip=4 Tokens=2*" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
 set _var=%%b
 echo !_var!
 IF "!_var!"=="" (
 echo.Key is blank. I never see this line.
 ) else (
 echo.Key is not blank. I never see this line.
 )
)
```


----------



## Squashman (Apr 4, 2003)

_Posted via Mobile Device_
changing the @echo off isn't going to make the code work any differently.
We don't have the reg key you are working with so there is no way for us to code it exactly for you. I just found a blank key and tested with that. You will have to play around with the skip and token values to make it work for you.


----------



## scrfix (May 3, 2009)

No problem. I actually fell asleep until just about 10 minutes ago when a client called in. Just wiped out from work. I did try token combinations on Jerry's. I did not however on yours. Fell asleep right after typing that. Will however try different combinations.

*Updated*
This worked however I have not tested it to see if it is still repeating 3 times or not. I will check that and get back

```
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do set _variable=%%b
IF NOT DEFINED _variable (GOTO _VARNOTDEFINED) ELSE (GOTO _VARDEFINED)
::
```


----------



## scrfix (May 3, 2009)

The above code looked twice before it decided it found the answer. The following code works flawlessly with one minor touchback that is not affecting the function of the code at all. I am just not sure why it happens.


```
For /F "Tokens=2* skip=2" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
set _variable=%%b
echo %_variable%
)
IF NOT DEFINED _variable (GOTO _VARNOTDEFINED) ELSE (GOTO _VARDEFINED)
 
:_VARNOTEDEFINED
Echo The variable was not defined so run code here.
 
:_VARDEFINED
Echo The variable was defined so run code here.
pause
::
```
The echo statement is in question.

1. I open a command prompt with administrative rights on Vista.
2. I create a registry entry to work with.
REG ADD "HKLM\Software\S C R" /v "UserID" /t REG_SZ /d "1234" /f
3. I open the registry and navigate to that registry key.
4. I run the above code. It brings me to _VARDEFINED.
5. I manually edit the registry and delete the 1234 from the value UserID.
6. I run the code again. It echoes back that the variable is 1234 however still sends me to the correct place ie. _VARNOTDEFINED.
7. I run the code again. I now get an Echo is off reply and it still sends me to the correct place _VARNOTDEFINED
8. I manually add 1234 to the registry value again.
9. I run the code again. I receive an Echo is off reply however it still sends me to the correct place ie. _VARDEFINED.

Please keep in mind I have attempted this with and without Setlocal enableddelayedexpansion before the FOR statement.

The code works beautifully. Any ideas on why the echo acts the way it does? This is pure curiousity.

*Updated*
I removed the REG ADD from the code realizing that if it wasn't removed after the first time, it would continually force the 1234 into the registry. You will have to manually run the REG ADD code provided above.


----------



## TheOutcaste (Aug 8, 2007)

I created a HKLM\Software\S C R key.
Get an error as expected as there is no UserID item.
Added a UserID item and left it null
Code shows it's not defined
Gave it a value of Jerry, and it says value is Jerry
Here's my test file

```
@Echo Off
Set _Variable=
For /F "Tokens=3 skip=4" %%I In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do Set _Variable=%%I
If Defined _variable (Goto _HasValue) Else (Goto _IsNull)
Goto :EOF
:_HasValue
Echo UserID is %_Variable%
Goto :EOF
:_IsNull
Echo UserID is not defined
```
Here's the result

```
[COLOR=DarkRed]UserID does not exist:[/COLOR]
C:\>test

Error:  The system was unable to find the specified registry key or value
UserID is not defined
[COLOR=DarkRed]UserID exists and is blank[/COLOR]
C:\>test
UserID is not defined
[COLOR=DarkRed]UserID exists and is Jerry[/COLOR]
C:\>test
UserID is Jerry

C:\>
```
If you can show us the result of 
* Reg query "HKLM\Software\S C R" /v "UserID"*
run from a prompt that might help to see why you are getting the R assigned to the variable.

And for delayed expansion to work, you need to use *echo !_variable!*, not *echo %_variable%*
I didn't test on Vista, so it looks like the skip line needs to be different for Vista


----------



## TheOutcaste (Aug 8, 2007)

You need to use Skip=2 on Vista. Skip=2 will also work on XP, so no need to do any OS checking, it will just parse the key name as well as the last line with the data.

Guess I should have checked both Vista and XP

EDIT: Also, to avoid the Echo is Off display when the variable is undefined, use *echo.!_variable!*, or *Echo _Variable is:!_Variable!*

If the variable is undefined, the statement becomes just "Echo " with one space, and cmd.exe trims trailing spaces in this case as there is no Text to display, so it display the current Echo setting.


----------



## scrfix (May 3, 2009)

Just FYI for anyone searching on the subject. If you are like me, you searched all over the place for checking nul or empty values in the registry keys.

You might have ran by the same sites I did. I read on a different website forum that how to check for nul values in the registry and they even provided examples utilized in my original post at the top of the first page of this thread.
*This is not correct!*

However I did figure out that what the >nul does. It is utilized to prevent the Registry command from outputting to the command line whilst still executing the command. This is a very good tip for people such as myself that do not want the reg query errors or the reg add confirmations not to appear on the screen.

I was corrected by TheOutCaste and Explained in detail on Page 2.
The 2>nul is correct for stopping the errors from posting to the screen. The errorlevel will still be set even if you stop the errors from posting. The space is necessary as I could not get it to prevent the error on my Vista computer without it.
http://forums.techguy.org/6851348-post17.html

*Examples*

```
REG Query "HKLM\SOFTWARE\[B]SomeEntry[/B]" /v "[B]SomeValue[/B]" [B][COLOR=red]2[/COLOR][COLOR=red]>nul[/COLOR][/B]
```
That will prevent the error from coming up onto the screen stating that there is no entry

OR


```
REG Query "HKLM\SOFTWARE\[B]SomeEntry[/B]" /v "[B]SomeValue[/B]" [B][COLOR=red]1>nul [/COLOR][COLOR=red]2[/COLOR][COLOR=red]>nul[/COLOR][/B]
```
This will prevent the successful command line output from coming up should the entry be there and prevent the error from outputting to the command line should the query not be there.

OR

The space is not necessary here. It works just fine on my Vista machine.

```
REG ADD "HKLM\Software\[B]SomeEntry[/B]" /v [B]"SomeValue"[/B] /t REG_SZ /d [B]"SomeData"[/B] /f[COLOR=red][B]>nul[/B][/COLOR]
```
That will prevent the response of Operating Completed Successfully because it has the >nul at the end of the statement.

Just a quick tip I learned while these guys were helping me learn.


----------



## scrfix (May 3, 2009)

I think I figured out the difference. You have your variable being set to nothing before the statement. I didn't have that. Perhaps it is cached from before.

I will perform a test really quick and post some print screens of what I am talking about.


----------



## TheOutcaste (Aug 8, 2007)

That would be part of it, but remember that *%var%* is expanded when the *line* is processed, where *!var!* is expanded when the *command* is processed. Your For loop appears to be on four lines but is actually only one. The *(* at the end acts as line continuation character which allows a long line to be displayed on multiple lines in an editor, mainly for readability.

If you add a *Set _variable=* to your code, your Echo statement will never display anything, as the %_Variable% will be expanded when the *line* is processed, which is before the For loop assigns it a value. At that point the variable is undefined.
My code doesn't need Delayed Expansion as I'm not trying to echo from inside the loop.


scrfix said:


> ```
> REG Query "HKLM\SOFTWARE\[B]SomeEntry[/B]" /v "[B]SomeValue[/B]"[B][COLOR=red]>nul[/COLOR][/B]
> ```
> That will prevent the error from coming up onto the screen stating that there is no entry


Not quite. That will prevent the display of the command output, but not the error. The two lines in red are not displayed when you use >Nul:

```
C:\test1>Reg query "HKLM\Software\ACD Systems" /v "Path"

[COLOR=Red]! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\Software\ACD Systems
[/COLOR]

Error:  The system was unable to find the specified registry key or value

C:\test1>Reg query "HKLM\Software\ACD Systems" /v "Path">Nul

Error:  The system was unable to find the specified registry key or value

C:\test1>Reg query "HKLM\Software\ACD Systems" /v "Path" 2>Nul

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\Software\ACD Systems


C:\test1>
```
>Nul actually means 1>Nul, where the number one is the handle being redirected. 1 is STDOUT (Standard Output)
To prevent the error, you need to use 2>Nul as I did in the 3rd example.
2 is STDERR (Standard Error). 0 is STDIN (Keyboard Input). The Handles from 3-9 are not defined by cmd.exe but can be defined by other applications.

It will suppress the Operation Completed Successfully message because success is not an error


----------



## scrfix (May 3, 2009)

Found some errors within the code however nothing that would effect what we are doing.
*Final Code*

```
@echo off
For /F "Tokens=2* skip=2" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
set _variable=%%b
echo %_variable%
)
IF NOT DEFINED _variable (GOTO _VARNOTDEFINED) ELSE (GOTO _VARDEFINED)
:_VARNOTDEFINED
Echo The variable was not defined so run code here.
GOTO :EOF
:_VARDEFINED
Echo The variable was defined so run code here.
pause
::
```
*Steps repeated from above for reference:*
1. I open a command prompt with administrative rights on Vista.
2. I create a registry entry to work with.
REG ADD "HKLM\Software\S C R" /v "UserID" /t REG_SZ /d "1234" /f
3. I open the registry and navigate to that registry key.
4. I run the above code. It brings me to _VARDEFINED.
5. I manually edit the registry and delete the 1234 from the value UserID.
6. I run the code again. It echoes back that the variable is 1234 however still sends me to the correct place ie. _VARNOTDEFINED.
7. I run the code again. I now get an Echo is off reply and it still sends me to the correct place _VARNOTDEFINED
8. I manually add 1234 to the registry value again.
9. I run the code again. I receive an Echo is off reply however it still sends me to the correct place ie. _VARDEFINED.

I also attached the images just in case these get deleted from my website in the future.

Damn if I didn't forget about the !! for delayedexpansion. I will try that next.


----------



## scrfix (May 3, 2009)

Ok,

It was enabledelayedexpansion.
This is a perfect example for others of where delayed expansion is needed.
Without it, you get that minor error.
With it, it works perfectly.

*Final Code with DelayedExpansion*

```
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
For /F "Tokens=2* skip=2" %%a In ('Reg query "HKLM\Software\S C R" /v "UserID"') Do (
set _variable=%%b
echo !_variable!
)
IF NOT DEFINED _variable (GOTO _VARNOTDEFINED) ELSE (GOTO _VARDEFINED)
:_VARNOTDEFINED
Echo The variable was not defined so run code here.
GOTO :EOF
:_VARDEFINED
Echo The variable was defined so run code here.
pause
ENDLOCAL DISABLEDELAYEDEXPANSION
::
```


----------



## scrfix (May 3, 2009)

TheOutcaste said:


> That would be part of it, but remember that *%var%* is expanded when the *line* is processed, where *!var!* is expanded when the *command* is processed. Your For loop appears to be on four lines but is actually only one. The *(* at the end acts as line continuation character which allows a long line to be displayed on multiple lines in an editor, mainly for readability.
> 
> If you add a *Set _variable=* to your code, your Echo statement will never display anything, as the %_Variable% will be expanded when the *line* is processed, which is before the For loop assigns it a value. At that point the variable is undefined.
> My code doesn't need Delayed Expansion as I'm not trying to echo from inside the loop.
> ...


Damn it. I just checked it and absolutely correct. I had already created that registry entry so it was finding it where I thought it was the >NUL value that was preventing the error. I will correct that in my post. Thanks for pointing that out.

If I stop the error from showing, will errorlevel still be set?
*I checked it. The errorlevel is still set even though the error doesn't show.*
*Thanks for correcting the tip.*


----------



## TheOutcaste (Aug 8, 2007)

You don't need the DisableDelayedExpansion after the Endlocal. It doesn't cause an error, but does nothing and is ignored. The Endlocal will restore the previous state of DelayedExpansion.
Try this to see the effects of using % vs !, and using Echo.%VAR% vs Echo %VAR%. I used two setlocals to show that EndLocal DisableDelayedExpansion will not disable expansion.

```
@Echo Off
SetLocal EnableDelayedExpansion
SetLocal EnableDelayedExpansion
Set _Variable=Fred
For /L %%I In (1,1,10) Do (
Set _Variable=%%I
Echo %_Variable%
)
Echo End of Loop. Variable is now:
Echo %_Variable%
EndLocal DisableDelayedExpansion
Set _Variable=Fred
For /L %%I In (1,1,10) Do (
Set _Variable=%%I
Echo !_Variable!
)
Echo Loops are done
Set _Variable=
Echo Echoing null variable without a period
Echo %_Variable%
Echo Echoing null variable with a period
Echo.%_Variable%
```
Redirecting will not affect how ERRORLEVEL gets set, just where the output is sent. And I see you already checked that

If you have a DOS printer driver installed for this console session, you could use *2>LPT1* or *2>PRN* to have errors printed on your printer. Getting a printer to work in a command prompt is a whole 'nuther story though


----------



## scrfix (May 3, 2009)

*Breaking this down*
@Echo Off - Don't Repeat Commands, Just Execute

SetLocal EnableDelayedExpansion - Setting SetLocal 1 time
SetLocal EnableDelayedExpansion - Setting SetLocal a second time.
*Now, as I understand it, if there are two setlocals then there should be two endlocals unless it is the end of the batch file which then it merely sets an endlocal and reverts everything back because the batch has ended. Is that correct?*

Set _Variable=Fred - Set Fred as the variable data

*The FOR loop says to count numbers in sequence starting at 1, incrementing by 1 and go up to 10.*
For /L %%I In (1,1,10) Do (
Set _Variable=%%I - Resetting the variable to equal the number
Echo %_Variable% - Echo the number but because delayed expansion is not set with the !! around the variable it will repeat Fred because it believes that is what it is.
)
Echo End of Loop. Variable is now:
Echo %_Variable% - Now that the FOR loop is over, it now knows executes the set variable inside the FOR loop and changes the _variable to equal 10.
EndLocal DisableDelayedExpansion - End Local Now we are disabling Delayed Expansion for 1 of the above statements however it still remains for the other statement, correct or incorrect?

Set _Variable=Fred - Set Variable back to Fred

The FOR loop is the same as the above with incrementing
For /L %%I In (1,1,10) Do (
Set _Variable=%%I - Once again, change the variable to a sequence of numbers.
Echo !_Variable! - This time, include the !! which will wait until the end of the FOR statement to execute so therefore, it now sees that the variable has now changed to a number and executes it as such.
)
Echo Loops are done
Set _Variable= - Change the Variable to a NULL value
Echo Echoing null variable without a period
Echo %_Variable% - Return the Echo is Off output
Echo Echoing null variable with a period
Echo.%_Variable% - Do not return the Echo is Off output

With the exception of the couple of questions, by jove I think I am getting it.


----------



## TheOutcaste (Aug 8, 2007)

scrfix said:


> *Breaking this down*
> SetLocal EnableDelayedExpansion - Setting SetLocal 1 time
> SetLocal EnableDelayedExpansion - Setting SetLocal a second time.


This would be closer:
Creating and switching to *Local Environment 1* with Delayed Expansion Enabled
Creating and switching to *Local Environment 2* with Delayed Expansion Enabled



scrfix said:


> *Now, as I understand it, if there are two setlocals then there should be two endlocals unless it is the end of the batch file which then it merely sets an endlocal and reverts everything back because the batch has ended. Is that correct?*


 Correct, depending on the end of the file to do the last Endlocal


scrfix said:


> Set _Variable=Fred - Set Fred as the variable data


Note that *_Variable* is being created in *Local Environment 2* and does not exist in *Local Environment 1* or the Command Prompt environment that the batch file started in.


scrfix said:


> *The FOR loop says to count numbers in sequence starting at 1, incrementing by 1 and go up to 10.*
> For /L %%I In (1,1,10) Do (
> Set _Variable=%%I - Resetting the variable to equal the number
> Echo %_Variable% - Echo the number but because delayed expansion is not set with the !! around the variable it will repeat Fred because it believes that is what it is.
> )



Remember the For loop is really one long line:
*For /L %%I In (1,1,10) Do (Set _Variable=%%I)&(Echo %_Variable%)*
Variables using the % are expanded before the line executes, so the line becomes this:
*For /L %I In (1,1,10) Do (Set _Variable=%I)&(Echo Fred)*
So when this line is executed, the Echo statement doesn't contain a variable, it contains the _value_ of the variable when the expansion of variables was done. The value of the _Variable is being updated, but we don't have a command to display it in this line anymore.


scrfix said:


> Echo End of Loop. Variable is now:
> Echo %_Variable% - Now that the FOR loop is over, it now knows executes the set variable inside the FOR loop and changes the _variable to equal 10.


The Set statement was being executed the entire time, we just weren't displaying the result.
The %_Variable% is expanded before the line is executed. It's not expanded until the For loop is complete, so the current value of _Variable is used, which is 10 so this line is Now *Echo 10*


scrfix said:


> EndLocal DisableDelayedExpansion - End Local Now we are disabling Delayed Expansion for 1 of the above statements however it still remains for the other statement, correct or incorrect?


The DisableDelayedExpansion does absolutely nothing. If you type Endlocal /? at the prompt you'll see that there are no arguments for Endlocal. This really should return an error.
What this actually does is end *Local Environment 2* discarding all variables created or changed while *Local Environment 2* was in effect and drop back to the previous environment, *Local Environment 1*. *Local Environment 1* has Delayed Expansion Enabled.


scrfix said:


> Set _Variable=Fred - Set Variable back to Fred


Since _Variable was defined in *Local Environment 2* it's actually undefined at this point.
I should have put *If NOT Defined _Variable Echo _Variable is not Defined* just before this to indicate that.


scrfix said:


> The FOR loop is the same as the above with incrementing
> For /L %%I In (1,1,10) Do (
> Set _Variable=%%I - Once again, change the variable to a sequence of numbers.
> Echo !_Variable! - This time, include the !! which will wait until the end of the FOR statement to execute so therefore, it now sees that the variable has now changed to a number and executes it as such.
> )


Since we used ! and Delayed Expansion is enabled, !_Variable! is not expanded when the line is processed, so the line is now:
*For /L %I In (1,1,10) Do (Set _Variable=%I)&(Echo !_Variable!**)*
The variable will be expanded when the Echo command is executed, which is After the Set, so now this will display the value as it is changed.


scrfix said:


> Echo Loops are done
> Set _Variable= - Change the Variable to a NULL value
> Echo Echoing null variable without a period
> Echo %_Variable% - Return the Echo is Off output
> ...


When the variable is expanded, the line becomes just Echo followed by one space.
Echo by itself, or with nothing but spaces after it returns the state of the Echo setting, either *Echo is Off* or *Echo is On*. This just shows that trailing spaces after a command are ignored. Type Echo followed by several spaces at the prompt and you'll see they are ignored.
To Echo a line of spaces, or a blank line, you have to use *Echo.*.

```
[B]Echo >>Test.txt[/B] will output the state of the Echo setting
[B]Echo.>>Test.txt[/B] will output a blank line (CR/LF)
[B]Echo.     >>Test.txt[/B] Will output a line of 5 spaces
```



scrfix said:


> With the exception of the couple of questions, by jove I think I am getting it.


:up:


----------

