On 5/20/2013 5:38 AM, V�clav Zeman wrote:
> Hi.
>
> I would like to push/pop echo state similar to what `setlocal` and `endlocal` does for environment variables. Is this reasonably easily possible?
>
You can launch a child CMD instance, change the ECHO state to suit that
instance and when it exits the ECHO state of the original instance will
be restored. Here are two batches to demonstrate.
::This is Demo1.cmd
@echo off
echo this is %~nx0 and ECHO is OFF
cmd /c Demo2
echo control returned to %~nx0 but ECHO is still off
pause
::This is Demo2.cmd
echo control passed to %~nx0 and ECHO is ON
dir
echo this is %~nx0 and ECHO is ON
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)