D
Den
Group:
I needed a command file that would save the ECHO state at the beginning of
the file and then restore the ECHO state at the end.
I came up with the following simple command line (written for command
prompt -- double the %'s for command file!):
for /f "tokens=3 delims=. " %s in ('echo') do set echostate=%s
... which I believe should set the environment variable "echostate" to
either "on" or "off", dependant on the current setting of ECHO.
However, under XP Pro it always sets the value to "on", regardless of the
actual current setting of ECHO.
So, to test, I changed the line to:
for /f "tokens=3 delims=. " %s in ('echo') do echo --%s--
... at the command line this always returns "--on--", regardless of the
actual current setting of ECHO (i.e. is consitent with the earlier example).
Further playing around (at the command prompt) shows that the ECHO command
yields "ECHO is off.", or "ECHO is on." depending on the state of ECHO,
*but*, ECHO|MORE always yields "ECHO is on." even when ECHO is set off.
I'm missing something here ... can someone explain?
Cheers
Den
I needed a command file that would save the ECHO state at the beginning of
the file and then restore the ECHO state at the end.
I came up with the following simple command line (written for command
prompt -- double the %'s for command file!):
for /f "tokens=3 delims=. " %s in ('echo') do set echostate=%s
... which I believe should set the environment variable "echostate" to
either "on" or "off", dependant on the current setting of ECHO.
However, under XP Pro it always sets the value to "on", regardless of the
actual current setting of ECHO.
So, to test, I changed the line to:
for /f "tokens=3 delims=. " %s in ('echo') do echo --%s--
... at the command line this always returns "--on--", regardless of the
actual current setting of ECHO (i.e. is consitent with the earlier example).
Further playing around (at the command prompt) shows that the ECHO command
yields "ECHO is off.", or "ECHO is on." depending on the state of ECHO,
*but*, ECHO|MORE always yields "ECHO is on." even when ECHO is set off.
I'm missing something here ... can someone explain?
Cheers
Den